[studio,nostalgia/studio] Make executing UndoCommands report errors
All checks were successful
Build / build (push) Successful in 2m31s
All checks were successful
Build / build (push) Successful in 2m31s
This commit is contained in:
@@ -131,16 +131,14 @@ class Editor: public studio::BaseEditor {
|
||||
[[nodiscard]]
|
||||
UndoStack *undoStack() noexcept final;
|
||||
|
||||
void pushCommand(ox::UPtr<UndoCommand> &&cmd) noexcept;
|
||||
ox::Error pushCommand(ox::UPtr<UndoCommand> &&cmd) noexcept;
|
||||
|
||||
template<typename UC, typename ...Args>
|
||||
bool pushCommand(Args&&... args) noexcept {
|
||||
ox::Error pushCommand(Args&&... args) noexcept {
|
||||
try {
|
||||
m_undoStack.push(ox::make_unique<UC>(ox::forward<Args>(args)...));
|
||||
return true;
|
||||
return m_undoStack.push(ox::make_unique<UC>(ox::forward<Args>(args)...));
|
||||
} catch (ox::Exception const&ex) {
|
||||
oxLogError(ex.toError());
|
||||
return false;
|
||||
return ex.toError();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,11 +19,11 @@ class UndoStack {
|
||||
std::size_t m_stackIdx = 0;
|
||||
|
||||
public:
|
||||
void push(ox::UPtr<UndoCommand> &&cmd) noexcept;
|
||||
ox::Error push(ox::UPtr<UndoCommand> &&cmd) noexcept;
|
||||
|
||||
void redo() noexcept;
|
||||
ox::Error redo() noexcept;
|
||||
|
||||
void undo() noexcept;
|
||||
ox::Error undo() noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool canRedo() const noexcept {
|
||||
|
Reference in New Issue
Block a user