TextEditor: suppress "Not found" window when searching for empty string
Minor patch, but I was watching one of your videos on YouTube and thought that the pop-up was unecessary/annoying in this case. Love your enthusiasm for the project :^)
This commit is contained in:
parent
af3d8e9c59
commit
10324bc574
Notes:
sideshowbarker
2024-07-19 11:41:35 +09:00
Author: https://github.com/keggsmurph21 🔰 Commit: https://github.com/SerenityOS/serenity/commit/10324bc574a Pull-request: https://github.com/SerenityOS/serenity/pull/662
1 changed files with 8 additions and 0 deletions
|
@ -46,6 +46,10 @@ TextEditorWidget::TextEditorWidget()
|
|||
|
||||
m_find_next_action = GAction::create("Find next", { Mod_Ctrl, Key_G }, [&](auto&) {
|
||||
auto needle = m_find_textbox->text();
|
||||
if (needle.is_empty()) {
|
||||
dbg() << "find_next(\"\")";
|
||||
return;
|
||||
}
|
||||
auto found_range = m_editor->find_next(needle, m_editor->normalized_selection().end());
|
||||
dbg() << "find_next(\"" << needle << "\") returned " << found_range;
|
||||
if (found_range.is_valid()) {
|
||||
|
@ -60,6 +64,10 @@ TextEditorWidget::TextEditorWidget()
|
|||
});
|
||||
m_find_previous_action = GAction::create("Find previous", { Mod_Ctrl | Mod_Shift, Key_G }, [&](auto&) {
|
||||
auto needle = m_find_textbox->text();
|
||||
if (needle.is_empty()) {
|
||||
dbg() << "find_prev(\"\")";
|
||||
return;
|
||||
}
|
||||
|
||||
auto selection_start = m_editor->normalized_selection().start();
|
||||
if (!selection_start.is_valid())
|
||||
|
|
Loading…
Add table
Reference in a new issue