Explorar el Código

feat(gtk): disable completion popover by default via config

Disabled GTK completion popover by default through a Lua configuration flag (show_completion_popover=false). Updated GtkEditor to conditionally instantiate and show the popover based on this setting. This addresses a user request to temporarily disable the popover due to performance/usability concerns.
Bernardo Magri hace 1 mes
padre
commit
0ac653930f
Se han modificado 3 ficheros con 12 adiciones y 6 borrados
  1. 1 0
      documentation/PLAN.md
  2. 2 0
      src/defaults.hpp
  3. 9 6
      src/gtk_editor.cpp

+ 1 - 0
documentation/PLAN.md

@@ -139,6 +139,7 @@ Lumacs/
 - ✅ **Minibuffer & Command System**: Minibuffer core logic, history management, and completion are fully centralized and integrated with the Command System (Phases Z and C completed).
     - **Advanced Completion UI**: Completed (Implemented popup completion window with descriptions and better visual feedback).
     - **Minibuffer & Popover Polish**: ✅ Fixed. Exposed ISearch direction control, fixed TUI rendering and Backspace, fixed GTK minibuffer double-rendering and disappearance, and polished GTK Popover positioning and focus management.
+    - [x] **GTK Completion Popover**: Disabled by default via Lua configuration (user request).
 - ✅ **Theme System Refactoring**:
     - [x] Implemented `editor:create_and_register_theme` Lua API to allow theme definition from Lua.
     - [x] Factored all hardcoded C++ themes (`default`, `everforest-dark`, `dracula`, `solarized-dark`, `nord`, `gruvbox-light`) into individual Lua files (`lua/themes/*.lua`).

+ 2 - 0
src/defaults.hpp

@@ -12,6 +12,8 @@ constexpr const char* LUA_DEFAULTS = R"(
 -- 1. Sane Editor Config
 editor.config:set("show_line_numbers", true)
 editor.config:set("tab_width", 4)
+-- Disable completion popover by default
+editor.config:set("show_completion_popover", false)
 
 -- 2. Mode Infrastructure
 local major_modes = {}

+ 9 - 6
src/gtk_editor.cpp

@@ -423,11 +423,13 @@ void GtkEditor::on_activate() {
         sigc::mem_fun(*this, &GtkEditor::on_cursor_blink), BLINK_INTERVAL.count()
     );
 
-    // Initialize completion popup
-    completion_popup_ = std::make_unique<GtkCompletionPopup>();
-    // Popovers are automatically transient and handle their own hide_on_close logic.
-    completion_popup_->signal_candidate_selected().connect(sigc::mem_fun(*this, &GtkEditor::on_completion_selected));
-    completion_popup_->signal_cancelled().connect(sigc::mem_fun(*this, &GtkEditor::on_completion_cancelled));
+    // Initialize completion popup (conditionally)
+    if (core_ && core_->config().get<bool>("show_completion_popover", true)) {
+        completion_popup_ = std::make_unique<GtkCompletionPopup>();
+        // Popovers are automatically transient and handle their own hide_on_close logic.
+        completion_popup_->signal_candidate_selected().connect(sigc::mem_fun(*this, &GtkEditor::on_completion_selected));
+        completion_popup_->signal_cancelled().connect(sigc::mem_fun(*this, &GtkEditor::on_completion_cancelled));
+    }
 
     // Attach global key controller to the main window
     auto global_key_controller = Gtk::EventControllerKey::create();
@@ -668,7 +670,8 @@ Gtk::Widget* GtkEditor::create_widget_for_layout_node(std::shared_ptr<LayoutNode
 // === Completion Popup Helpers ===
 
 void GtkEditor::show_completion_popup() {
-    if (!completion_popup_ || !window_) return;
+    // Only show if popover is enabled and initialized
+    if (!completion_popup_ || !window_ || !core_->config().get<bool>("show_completion_popover", true)) return;
 
     auto candidates = core_->minibuffer_manager().get_completion_candidates();
     if (candidates.empty()) {