Browse Source

LibLine: Cleanup the suggestions before inserting a new code point

Otherwise `reposition_cursor()` will move the cursor one character too
far to the right, and since we don't redraw the entire buffer when
the character is inserted at the end, the mistake won't be immediately
fixed by a complete redraw.
Fixes #5722
AnotherTest 4 years ago
parent
commit
eb1ca965c7
1 changed files with 3 additions and 0 deletions
  1. 3 0
      Userland/Libraries/LibLine/Editor.cpp

+ 3 - 0
Userland/Libraries/LibLine/Editor.cpp

@@ -1033,6 +1033,9 @@ void Editor::handle_read_event()
             continue;
             continue;
         }
         }
 
 
+        // If we got here, manually cleanup the suggestions and then insert the new code point.
+        suggestion_cleanup.disarm();
+        cleanup_suggestions();
         insert(code_point);
         insert(code_point);
     }
     }