[studio] Fix misrender flash on tab close
This commit is contained in:
parent
4461f99fa4
commit
4e068d628c
@ -231,7 +231,10 @@ void StudioUI::drawTabs() noexcept {
|
|||||||
if (m_activeEditorOnLastDraw != e.get()) [[unlikely]] {
|
if (m_activeEditorOnLastDraw != e.get()) [[unlikely]] {
|
||||||
m_activeEditor->onActivated();
|
m_activeEditor->onActivated();
|
||||||
}
|
}
|
||||||
if (open) [[likely]] {
|
if (m_closeActiveTab) [[unlikely]] {
|
||||||
|
ImGui::SetTabItemClosed(e->itemDisplayName().c_str());
|
||||||
|
|
||||||
|
} else if (open) [[likely]] {
|
||||||
e->draw(m_sctx);
|
e->draw(m_sctx);
|
||||||
}
|
}
|
||||||
m_activeEditorOnLastDraw = e.get();
|
m_activeEditorOnLastDraw = e.get();
|
||||||
@ -258,6 +261,20 @@ void StudioUI::drawTabs() noexcept {
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (m_closeActiveTab) [[unlikely]] {
|
||||||
|
if (m_activeEditor) {
|
||||||
|
auto const idx = find_if(
|
||||||
|
m_editors.begin(), m_editors.end(),
|
||||||
|
[this](ox::UPtr<BaseEditor> const &e) {
|
||||||
|
return m_activeEditor == e.get();
|
||||||
|
});
|
||||||
|
if (idx != m_editors.end()) {
|
||||||
|
oxLogError(m_editors.erase(idx.offset()).error);
|
||||||
|
}
|
||||||
|
m_activeEditor = nullptr;
|
||||||
|
}
|
||||||
|
m_closeActiveTab = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::loadEditorMaker(EditorMaker const&editorMaker) noexcept {
|
void StudioUI::loadEditorMaker(EditorMaker const&editorMaker) noexcept {
|
||||||
@ -407,13 +424,12 @@ ox::Error StudioUI::handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR ne
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error StudioUI::handleDeleteFile(ox::StringViewCR path) noexcept {
|
ox::Error StudioUI::handleDeleteFile(ox::StringViewCR path) noexcept {
|
||||||
for (size_t i{}; auto &e : m_editors) {
|
for (auto &e : m_editors) {
|
||||||
if (path == e->itemPath()) {
|
if (path == e->itemPath()) {
|
||||||
oxLogError(m_editors.erase(i).error);
|
|
||||||
oxLogError(closeFile(path));
|
oxLogError(closeFile(path));
|
||||||
|
m_closeActiveTab = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
return m_projectExplorer.refreshProjectTreeModel();
|
return m_projectExplorer.refreshProjectTreeModel();
|
||||||
}
|
}
|
||||||
@ -505,13 +521,12 @@ ox::Error StudioUI::handleCloseFileResponse(ig::PopupResponse const response) no
|
|||||||
}
|
}
|
||||||
|
|
||||||
ox::Error StudioUI::closeCurrentFile() noexcept {
|
ox::Error StudioUI::closeCurrentFile() noexcept {
|
||||||
for (size_t i{}; auto &e : m_editors) {
|
for (auto &e : m_editors) {
|
||||||
if (m_activeEditor == e.get()) {
|
if (m_activeEditor == e.get()) {
|
||||||
oxLogError(closeFile(e->itemPath()));
|
oxLogError(closeFile(e->itemPath()));
|
||||||
oxLogError(m_editors.erase(i).error);
|
m_closeActiveTab = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
BaseEditor *m_activeEditorOnLastDraw = nullptr;
|
BaseEditor *m_activeEditorOnLastDraw = nullptr;
|
||||||
BaseEditor *m_activeEditor = nullptr;
|
BaseEditor *m_activeEditor = nullptr;
|
||||||
BaseEditor *m_activeEditorUpdatePending = nullptr;
|
BaseEditor *m_activeEditorUpdatePending = nullptr;
|
||||||
|
bool m_closeActiveTab{};
|
||||||
ox::Vector<ox::Pair<ox::String>> m_queuedMoves;
|
ox::Vector<ox::Pair<ox::String>> m_queuedMoves;
|
||||||
ox::Vector<ox::Pair<ox::String>> m_queuedDirMoves;
|
ox::Vector<ox::Pair<ox::String>> m_queuedDirMoves;
|
||||||
NewMenu m_newMenu{keelCtx(m_tctx)};
|
NewMenu m_newMenu{keelCtx(m_tctx)};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user