From 10324bc574a7932883065085b6ff092cab7ba6bb Mon Sep 17 00:00:00 2001 From: Kevin Murphy Date: Tue, 15 Oct 2019 02:05:45 -0400 Subject: [PATCH] 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 :^) --- Applications/TextEditor/TextEditorWidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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())