summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Murphy <keggsmurph21@gmail.com>2019-10-15 02:05:45 -0400
committerAndreas Kling <awesomekling@gmail.com>2019-10-15 09:10:10 +0200
commit10324bc574a7932883065085b6ff092cab7ba6bb (patch)
tree452b99a68a1879f2d9edbdff1f501a780965e5e6
parentaf3d8e9c595e493b692b46916ff768030a0d0f59 (diff)
downloadserenity-10324bc574a7932883065085b6ff092cab7ba6bb.zip
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 :^)
-rw-r--r--Applications/TextEditor/TextEditorWidget.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp
index 49e047bf75..b0fa3ed791 100644
--- a/Applications/TextEditor/TextEditorWidget.cpp
+++ b/Applications/TextEditor/TextEditorWidget.cpp
@@ -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())