From cad7865ad194b57ed7a355358d0ab83dae2d3bd3 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Fri, 5 Mar 2021 15:31:13 +0330 Subject: [PATCH] LibLine: Clear the buffer after invalidating prior written data Otherwise this would set m_chars_touched_in_the_middle to zero, which is exactly the wrong thing to do. --- Userland/Libraries/LibLine/Editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index f7450f7fe7..96c883c40b 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -316,8 +316,8 @@ void Editor::clear_line() fputc(0x8, stderr); fputs("\033[K", stderr); fflush(stderr); - m_buffer.clear(); m_chars_touched_in_the_middle = buffer().size(); + m_buffer.clear(); m_cursor = 0; m_inline_search_cursor = m_cursor; }