✨ Feedback when undo or redo stack is empty
enhancement
### Description
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.
### Tasks
- [ ] 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.
### Alternatives Considered
_No response_
### Additional Context
_No response_
### Screenshots
_No response_
0 条评论