From 6861cb8a23ff0bce02edc03fabd098e8a92ecf53 Mon Sep 17 00:00:00 2001 From: Kesse Jones Date: Mon, 2 Nov 2020 08:32:52 -0300 Subject: [PATCH] HackStudio: Removes the file from the list of open files When a file is deleted from the project it will also be removed from the list of open files --- DevTools/HackStudio/HackStudioWidget.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DevTools/HackStudio/HackStudioWidget.cpp b/DevTools/HackStudio/HackStudioWidget.cpp index 2cd41c04a3..8c201c3904 100644 --- a/DevTools/HackStudio/HackStudioWidget.cpp +++ b/DevTools/HackStudio/HackStudioWidget.cpp @@ -351,7 +351,12 @@ NonnullRefPtr HackStudioWidget::create_delete_action() return; for (auto& file : files) { - if (!m_project->remove_file(file)) { + if (m_project->remove_file(file)) { + m_open_files_vector.remove_first_matching([&](auto& filename) { + return filename == file; + }); + m_open_files_view->model()->update(); + } else { GUI::MessageBox::show(window(), String::formatted("Removing file {} from the project failed.", file), "Removal failed",