You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user attempts to undo or redo and there are no more states in the respective stack, we should provide feedback to indicate that the action can't be performed. Right now, nothing happens, which can be confusing.
Requirements
Play a system beep (e.g., NSBeep()) when undo() or redo() is called but the stack is empty.
Disable the Undo menu item when canUndo is false.
Disable the Redo menu item when canRedo is false.
Ensure the menu item states update correctly when mutations are added or the stacks change (e.g., after undo(), redo(), or clearStack()).
Implementation Notes
Hook into undo() and redo() in CEUndoManager to check if the respective stack is empty, and call NSBeep() if it is.
Use a binding or delegate to notify the menu system to update the state of the Undo/Redo menu items when canUndo or canRedo changes.
Consider adding a didUpdateUndoRedoState callback or Notification for observing changes to canUndo / canRedo.
Motivation
This improves the UX by making the application behavior more intuitive and responsive. It matches the standard macOS UX expectations for undo/redo behavior.
Activity
NSBeep On Empty Undo, Remove Unnecessary Redirection (#102)