[nostalgia,studio] Fix crash that occurred when navigating to file that is not already open
All checks were successful
Build / build (push) Successful in 1m32s
All checks were successful
Build / build (push) Successful in 1m32s
This commit is contained in:
parent
d0a32e247e
commit
25a7873ea2
@ -566,8 +566,10 @@ void TileSheetEditorImGui::drawPaletteMenu() noexcept {
|
|||||||
m_view.setPalIdx(i);
|
m_view.setPalIdx(i);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) {
|
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) {
|
||||||
auto const rqst = ox::sfmt<ox::BasicString<100>>("{};{}", i, m_model.palettePage());
|
studio::navigateTo(
|
||||||
oxLogError(studio::navigateTo(m_sctx, m_model.palPath(), rqst));
|
m_sctx,
|
||||||
|
m_model.palPath(),
|
||||||
|
ox::sfmt("{};{}", i, m_model.palettePage()));
|
||||||
}
|
}
|
||||||
// Column: color RGB
|
// Column: color RGB
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
ox::Error navigateTo(StudioContext &ctx, ox::StringViewCR filePath, ox::StringViewCR args) noexcept {
|
void navigateTo(StudioContext &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept {
|
||||||
return ctx.ui.navigateTo(filePath, args);
|
ctx.ui.navigateTo(std::move(filePath), std::move(navArgs));
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ig {
|
namespace ig {
|
||||||
@ -111,10 +111,8 @@ void StudioUI::handleKeyEvent(turbine::Key const key, bool const down) noexcept
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error StudioUI::navigateTo(ox::StringViewCR path, ox::StringViewCR navArgs) noexcept {
|
void StudioUI::navigateTo(ox::StringParam path, ox::StringParam navArgs) noexcept {
|
||||||
OX_RETURN_ERROR(openFile(path));
|
m_navAction.emplace(std::move(path), std::move(navArgs));
|
||||||
m_activeEditor->navigateTo(navArgs);
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::draw() noexcept {
|
void StudioUI::draw() noexcept {
|
||||||
@ -287,6 +285,11 @@ void StudioUI::drawTabs() noexcept {
|
|||||||
}
|
}
|
||||||
m_closeActiveTab = false;
|
m_closeActiveTab = false;
|
||||||
}
|
}
|
||||||
|
if (m_navAction) {
|
||||||
|
oxLogError(openFile(m_navAction->path));
|
||||||
|
m_activeEditor->navigateTo(m_navAction->args);
|
||||||
|
m_navAction.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StudioUI::loadEditorMaker(EditorMaker const&editorMaker) noexcept {
|
void StudioUI::loadEditorMaker(EditorMaker const&editorMaker) noexcept {
|
||||||
|
@ -62,13 +62,18 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
&m_renameFile,
|
&m_renameFile,
|
||||||
};
|
};
|
||||||
bool m_showProjectExplorer = true;
|
bool m_showProjectExplorer = true;
|
||||||
|
struct NavAction {
|
||||||
|
ox::String path;
|
||||||
|
ox::String args;
|
||||||
|
};
|
||||||
|
ox::Optional<NavAction> m_navAction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept;
|
explicit StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept;
|
||||||
|
|
||||||
void handleKeyEvent(turbine::Key, bool down) noexcept;
|
void handleKeyEvent(turbine::Key, bool down) noexcept;
|
||||||
|
|
||||||
ox::Error navigateTo(ox::StringViewCR path, ox::StringViewCR navArgs = {}) noexcept;
|
void navigateTo(ox::StringParam path, ox::StringParam navArgs) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr Project *project() noexcept {
|
constexpr Project *project() noexcept {
|
||||||
|
@ -27,6 +27,6 @@ inline keel::Context &keelCtx(StudioContext &ctx) noexcept {
|
|||||||
return keelCtx(ctx.tctx);
|
return keelCtx(ctx.tctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error navigateTo(StudioContext &ctx, ox::StringViewCR filePath, ox::StringViewCR args) noexcept;
|
void navigateTo(StudioContext &ctx, ox::StringParam filePath, ox::StringParam navArgs) noexcept;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user