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.
This commit is contained in:
Lucas CHOLLET 2023-07-09 14:32:46 -04:00 committed by Andreas Kling
commit ea2ffdfd0e
Notes: sideshowbarker 2024-07-17 01:21:02 +09:00

View file

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