[studio,nostalgia/studio] Make executing UndoCommands report errors
All checks were successful
Build / build (push) Successful in 2m31s

This commit is contained in:
2024-05-23 21:50:27 -05:00
parent a1c89906bd
commit c0479604aa
7 changed files with 31 additions and 36 deletions

View File

@ -197,10 +197,10 @@ void StudioUI::drawMenu() noexcept {
if (ImGui::BeginMenu("Edit")) {
auto undoStack = m_activeEditor ? m_activeEditor->undoStack() : nullptr;
if (ImGui::MenuItem("Undo", "Ctrl+Z", false, undoStack && undoStack->canUndo())) {
undoStack->undo();
oxLogError(undoStack->undo());
}
if (ImGui::MenuItem("Redo", "Ctrl+Y", false, undoStack && undoStack->canRedo())) {
undoStack->redo();
oxLogError(undoStack->redo());
}
ImGui::Separator();
if (ImGui::MenuItem("Copy", "Ctrl+C", false, m_activeEditor && m_activeEditor->copyEnabled())) {
@ -315,14 +315,14 @@ void StudioUI::toggleProjectExplorer() noexcept {
void StudioUI::redo() noexcept {
auto undoStack = m_activeEditor ? m_activeEditor->undoStack() : nullptr;
if (undoStack && undoStack->canRedo()) {
m_activeEditor->undoStack()->redo();
oxLogError(m_activeEditor->undoStack()->redo());
}
}
void StudioUI::undo() noexcept {
auto undoStack = m_activeEditor ? m_activeEditor->undoStack() : nullptr;
if (undoStack && undoStack->canUndo()) {
m_activeEditor->undoStack()->undo();
oxLogError(m_activeEditor->undoStack()->undo());
}
}