diff options
author | Karol Kosek <krkk@krkk.ct8.pl> | 2021-08-12 22:42:48 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-12 22:10:48 +0200 |
commit | 6c5fb2ca63b300b748f7b8e66efa532a450b0a58 (patch) | |
tree | 671e647c04dce5045e5f24a251ff1c6996b7796f /Userland/DevTools | |
parent | d811ad921ca53201691500640d143425e7199611 (diff) | |
download | serenity-6c5fb2ca63b300b748f7b8e66efa532a450b0a58.zip |
HackStudio: Remove an old file from the vectors in 'Save as...' action
If you saved a file under a different name and then went back to
the first file, then you had the same TextDocument buffer, and therefore
the same changes to the file as in the new one.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index fb068f9c0f..4568188e63 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -701,7 +701,10 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action() auto new_project_file = m_project->create_file(relative_file_path); m_open_files.set(relative_file_path, *new_project_file); + m_open_files.remove(old_filename); + m_open_files_vector.append(relative_file_path); + m_open_files_vector.remove_all_matching([&old_filename](auto const& element) { return element == old_filename; }); update_window_title(); |