From 201890e109fae7af764840acfe3dba9297827e8a Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 9 Jul 2023 14:35:41 -0400 Subject: [PATCH] LibGUI: Don't call `on_escape_pressed` from EditingEngines The call will be handled in `TextEditor::keydown_event`, just after that `EditingEngine::on_key()` is called. --- Userland/Libraries/LibGUI/RegularEditingEngine.cpp | 6 ------ Userland/Libraries/LibGUI/VimEditingEngine.cpp | 12 +++--------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Userland/Libraries/LibGUI/RegularEditingEngine.cpp b/Userland/Libraries/LibGUI/RegularEditingEngine.cpp index 4e0639088d2..fe581289f87 100644 --- a/Userland/Libraries/LibGUI/RegularEditingEngine.cpp +++ b/Userland/Libraries/LibGUI/RegularEditingEngine.cpp @@ -20,12 +20,6 @@ bool RegularEditingEngine::on_key(KeyEvent const& event) if (EditingEngine::on_key(event)) return true; - if (event.key() == KeyCode::Key_Escape) { - if (m_editor->on_escape_pressed) - m_editor->on_escape_pressed(); - return true; - } - if (event.alt() && event.shift() && event.key() == KeyCode::Key_S) { sort_selected_lines(); return true; diff --git a/Userland/Libraries/LibGUI/VimEditingEngine.cpp b/Userland/Libraries/LibGUI/VimEditingEngine.cpp index 06f91470265..a5fd8ad1857 100644 --- a/Userland/Libraries/LibGUI/VimEditingEngine.cpp +++ b/Userland/Libraries/LibGUI/VimEditingEngine.cpp @@ -948,9 +948,7 @@ bool VimEditingEngine::on_key_in_normal_mode(KeyEvent const& event) // Handle first any key codes that are to be applied regardless of modifiers. switch (event.key()) { case (KeyCode::Key_Escape): - if (m_editor->on_escape_pressed) - m_editor->on_escape_pressed(); - return true; + return false; default: break; } @@ -1136,9 +1134,7 @@ bool VimEditingEngine::on_key_in_visual_mode(KeyEvent const& event) switch (event.key()) { case (KeyCode::Key_Escape): switch_to_normal_mode(); - if (m_editor->on_escape_pressed) - m_editor->on_escape_pressed(); - return true; + return false; default: break; } @@ -1268,9 +1264,7 @@ bool VimEditingEngine::on_key_in_visual_line_mode(KeyEvent const& event) switch (event.key()) { case (KeyCode::Key_Escape): switch_to_normal_mode(); - if (m_editor->on_escape_pressed) - m_editor->on_escape_pressed(); - return true; + return false; default: break; }