From 521475dc0149a1f7c0965e205cbfd06a9c62b616 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Sun, 6 Sep 2020 02:27:30 +0430 Subject: [PATCH] LibLine: Do not reset suggestion state immediately when encountering esc Some multikey binding might depend on the suggestion state, and this is indeed the case for 'reverse tab', which is just '^[[Z'. Fixes #3407. --- Libraries/LibLine/Editor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Libraries/LibLine/Editor.cpp b/Libraries/LibLine/Editor.cpp index 8f896beda6..76c7eaa553 100644 --- a/Libraries/LibLine/Editor.cpp +++ b/Libraries/LibLine/Editor.cpp @@ -664,6 +664,13 @@ void Editor::handle_read_event() ctrl_held = true; continue; } + if (code_point == 'Z') { + // 'reverse tab' + reverse_tab = true; + m_state = InputState::Free; + ctrl_held = false; + break; + } cleanup_suggestions(); switch (code_point) { case 'A': // ^[[A: arrow up @@ -702,11 +709,6 @@ void Editor::handle_read_event() m_state = InputState::Free; ctrl_held = false; continue; - case 'Z': // ^[[Z: shift+tab - reverse_tab = true; - m_state = InputState::Free; - ctrl_held = false; - break; case '3': // ^[[3~: delete erase_character_forwards(); m_search_offset = 0; @@ -726,7 +728,6 @@ void Editor::handle_read_event() case InputState::Free: if (code_point == 27) { m_state = InputState::GotEscape; - cleanup_suggestions(); continue; } break;