浏览代码

LibGUI: Bubble up Key_Escape if no hook is plugged in TextEditor

The TextEditor widget was always accepting the Key_Escape event even if
the `on_escape_pressed` was empty. In other words, it was discarding the
event.

This behavior prevented shortcuts to be activated at a higher level.
Lucas CHOLLET 2 年之前
父节点
当前提交
ea2ffdfd0e
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Userland/Libraries/LibGUI/TextEditor.cpp

+ 2 - 0
Userland/Libraries/LibGUI/TextEditor.cpp

@@ -1077,6 +1077,8 @@ void TextEditor::keydown_event(KeyEvent& event)
     if (event.key() == KeyCode::Key_Escape) {
     if (event.key() == KeyCode::Key_Escape) {
         if (on_escape_pressed)
         if (on_escape_pressed)
             on_escape_pressed();
             on_escape_pressed();
+        else
+            event.ignore();
         return;
         return;
     }
     }