[studio,nostalgia] Update tab name when corresponding file's name changes
All checks were successful
Build / build (push) Successful in 3m30s

This commit is contained in:
2025-01-26 00:52:11 -06:00
parent f840240aac
commit 046834c2b9
12 changed files with 34 additions and 12 deletions

View File

@ -9,7 +9,7 @@
namespace studio {
ClawEditor::ClawEditor(StudioContext &sctx, ox::StringParam path):
Editor(std::move(path)),
Editor(sctx, std::move(path)),
m_obj(sctx.project->loadObj<ox::ModelObject>(itemPath()).unwrapThrow()) {
}

View File

@ -373,7 +373,17 @@ ox::Error StudioUI::renameFile(ox::StringViewCR path) noexcept {
return m_renameFile.openPath(path);
}
ox::Error StudioUI::handleMoveFile(ox::StringViewCR, ox::UUID const&) noexcept {
ox::Error StudioUI::handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR newPath, ox::UUID const&) noexcept {
for (auto &f : m_openFiles) {
if (f == oldPath) {
f = newPath;
break;
}
}
// needed to keep this tab open, ImGui loses track when the name changes
if (m_activeEditor) {
m_activeEditorUpdatePending = m_activeEditor;
}
return m_projectExplorer.refreshProjectTreeModel();
}

View File

@ -100,7 +100,7 @@ class StudioUI: public ox::SignalHandler {
ox::Error renameFile(ox::StringViewCR path) noexcept;
ox::Error handleMoveFile(ox::StringViewCR path, ox::UUID const&id) noexcept;
ox::Error handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR newPath, ox::UUID const&id) noexcept;
ox::Error createOpenProject(ox::StringViewCR path) noexcept;