summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLennon Donaghy <donaghylennon@gmail.com>2021-08-02 19:26:20 +0100
committerAndreas Kling <kling@serenityos.org>2021-08-22 10:30:06 +0200
commit5ca888132dff6433006b1d6466d93011c91e959a (patch)
tree0f7bc06b75618c3ee11f06eb07750b90dc4851dc /Userland
parentff2a1ee8b0ef0369fe4ecc8988170b4971837331 (diff)
downloadserenity-5ca888132dff6433006b1d6466d93011c91e959a.zip
HackStudio: Make FindInFilesWidget reset when opening new project
Add method to FindInFilesWidget which resets the model in order to clear the output when needed, and use this when a new project is opened.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/DevTools/HackStudio/FindInFilesWidget.cpp4
-rw-r--r--Userland/DevTools/HackStudio/FindInFilesWidget.h2
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp1
3 files changed, 7 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp
index 88fa1ad899..f38474ed55 100644
--- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp
+++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp
@@ -148,5 +148,9 @@ void FindInFilesWidget::focus_textbox_and_select_all()
m_textbox->select_all();
m_textbox->set_focus(true);
}
+void FindInFilesWidget::reset()
+{
+ m_result_view->set_model(nullptr);
+}
}
diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.h b/Userland/DevTools/HackStudio/FindInFilesWidget.h
index 3b1c337090..38fd360efe 100644
--- a/Userland/DevTools/HackStudio/FindInFilesWidget.h
+++ b/Userland/DevTools/HackStudio/FindInFilesWidget.h
@@ -20,6 +20,8 @@ public:
void focus_textbox_and_select_all();
+ void reset();
+
private:
explicit FindInFilesWidget();
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 5ac37b27ec..cbd47fba3d 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -199,6 +199,7 @@ void HackStudioWidget::open_project(const String& root_path)
m_open_files.clear();
m_open_files_vector.clear();
add_new_editor(*m_editors_splitter);
+ m_find_in_files_widget->reset();
m_todo_entries_widget->clear();
m_terminal_wrapper->clear_including_history();
stop_debugger_if_running();