mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:17:34 +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
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_backwards.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
find_textbox.on_shift_return_pressed = [&]() {
|
||||||
|
find_forwards.click();
|
||||||
|
};
|
||||||
|
|
||||||
auto& match_case = search.add<GUI::CheckBox>("Case sensitive");
|
auto& match_case = search.add<GUI::CheckBox>("Case sensitive");
|
||||||
auto& wrap_around = search.add<GUI::CheckBox>("Wrap around");
|
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)
|
if (event.key() == KeyCode::Key_Tab)
|
||||||
return AbstractScrollableWidget::keydown_event(event);
|
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 (event.key() == KeyCode::Key_Return) {
|
||||||
if (on_return_pressed)
|
if (on_return_pressed)
|
||||||
on_return_pressed();
|
on_return_pressed();
|
||||||
|
|
|
@ -138,6 +138,7 @@ public:
|
||||||
Function<void(bool modified)> on_modified_change;
|
Function<void(bool modified)> on_modified_change;
|
||||||
Function<void()> on_mousedown;
|
Function<void()> on_mousedown;
|
||||||
Function<void()> on_return_pressed;
|
Function<void()> on_return_pressed;
|
||||||
|
Function<void()> on_shift_return_pressed;
|
||||||
Function<void()> on_escape_pressed;
|
Function<void()> on_escape_pressed;
|
||||||
Function<void()> on_up_pressed;
|
Function<void()> on_up_pressed;
|
||||||
Function<void()> on_down_pressed;
|
Function<void()> on_down_pressed;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue