From eb1ca965c756f6c0670db5fa1d747e72491f0699 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Thu, 11 Mar 2021 12:22:55 +0330 Subject: [PATCH] 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 --- Userland/Libraries/LibLine/Editor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index 96c883c40b..15ec22f05d 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -1033,6 +1033,9 @@ void Editor::handle_read_event() continue; } + // If we got here, manually cleanup the suggestions and then insert the new code point. + suggestion_cleanup.disarm(); + cleanup_suggestions(); insert(code_point); }