mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Terminal/LibGUI::TextEditor: Add shift+return to search forwards
This adds support for shift+return key combo in single line TextEditor fields. Used in this case for searching backwards/forwards in the Terminal find window.
This commit is contained in:
parent
9550564767
commit
11fa3e4f92
Notes:
sideshowbarker
2024-07-18 17:00:21 +09:00
Author: https://github.com/metmo Commit: https://github.com/SerenityOS/serenity/commit/11fa3e4f923 Pull-request: https://github.com/SerenityOS/serenity/pull/7694 Issue: https://github.com/SerenityOS/serenity/issues/7465
3 changed files with 11 additions and 0 deletions
|
@ -190,6 +190,10 @@ static RefPtr<GUI::Window> create_find_window(VT::TerminalWidget& terminal)
|
|||
find_backwards.click();
|
||||
};
|
||||
|
||||
find_textbox.on_shift_return_pressed = [&]() {
|
||||
find_forwards.click();
|
||||
};
|
||||
|
||||
auto& match_case = search.add<GUI::CheckBox>("Case sensitive");
|
||||
auto& wrap_around = search.add<GUI::CheckBox>("Wrap around");
|
||||
|
||||
|
|
|
@ -731,6 +731,12 @@ void TextEditor::keydown_event(KeyEvent& event)
|
|||
if (event.key() == KeyCode::Key_Tab)
|
||||
return AbstractScrollableWidget::keydown_event(event);
|
||||
|
||||
if (event.modifiers() == KeyModifier::Mod_Shift && event.key() == KeyCode::Key_Return) {
|
||||
if (on_shift_return_pressed)
|
||||
on_shift_return_pressed();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key() == KeyCode::Key_Return) {
|
||||
if (on_return_pressed)
|
||||
on_return_pressed();
|
||||
|
|
|
@ -138,6 +138,7 @@ public:
|
|||
Function<void(bool modified)> on_modified_change;
|
||||
Function<void()> on_mousedown;
|
||||
Function<void()> on_return_pressed;
|
||||
Function<void()> on_shift_return_pressed;
|
||||
Function<void()> on_escape_pressed;
|
||||
Function<void()> on_up_pressed;
|
||||
Function<void()> on_down_pressed;
|
||||
|
|
Loading…
Reference in a new issue