Просмотр исходного кода

fix(minibuffer): cursor not moving after tab completion, GTK crash

Fixed minibuffer cursor not moving to end of autocompleted string after Tab by updating cursor_position_. Resolved GTK frontend crash (basic_string::substr) by adding bounds check for completion suffix extraction in GtkRenderer.
Bernardo Magri 1 месяц назад
Родитель
Сommit
59c5e9c977
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 1
      documentation/PLAN.md
  2. 1 0
      src/minibuffer_manager.cpp

+ 1 - 1
documentation/PLAN.md

@@ -138,7 +138,7 @@ Lumacs/
 - ✅ **GTK Enhancements**: (Fully completed - Phase A).
 - ✅ **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.
+    - **Minibuffer & Popover Polish**: ✅ Fixed. Exposed ISearch direction control, fixed TUI rendering and Backspace, fixed GTK minibuffer double-rendering and disappearance, polished GTK Popover positioning and focus management, fixed GTK crash on completion mismatch, and fixed minibuffer cursor not moving after Tab completion.
     - [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.

+ 1 - 0
src/minibuffer_manager.cpp

@@ -260,6 +260,7 @@ std::optional<std::string> MinibufferManager::get_current_completion() const {
 void MinibufferManager::complete() {
     if (!completion_candidates_.empty()) {
         input_buffer_ = completion_candidates_[completion_index_].text;
+        cursor_position_ = input_buffer_.length(); // Update cursor position
         completion_index_ = (completion_index_ + 1) % completion_candidates_.size();
         // If we cycle, reset the index so next tab starts from the top.
         // Or, more Emacs-like, cycle through the list and if we get back to original,