Skip to content

feat: add Undo and UndoOrExit action variants#487

Open
clansty wants to merge 1 commit into
Satty-org:mainfrom
clansty:feat/undo-action
Open

feat: add Undo and UndoOrExit action variants#487
clansty wants to merge 1 commit into
Satty-org:mainfrom
clansty:feat/undo-action

Conversation

@clansty
Copy link
Copy Markdown

@clansty clansty commented Apr 14, 2026

Summary

  • Add undo and undo-or-exit as new action variants for action chains
  • undo: plain action, no-op if nothing to undo, always continues the chain
  • undo-or-exit: compound action — undo one step if possible, exit if nothing to undo
  • Route Enter/Escape/right-click through new process_actions method for consistent Undo support
  • No implicit control flow — compound behavior is explicit in the action name

Closes #485
Related discussion: #481

Copilot AI review requested due to automatic review settings April 14, 2026 08:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@RobertMueller2
Copy link
Copy Markdown
Member

Apologies for the delay in response, and thanks for the PRs.

process_actions can toss around the order. E.g. if I use --actions-on-right-click=copy-filepath-to-clipboard,undo-or-exit then undo-or-exit happens first, and if it exits, no filepath is copied.

I understand that it might be tricky to trigger a redraw for the undo, but we need to find a way to ensure the order of the actions. Ideally, we don't have action processing in two places. Perhaps some better queueing of the actions while escaping the action processing temporarily, from top of my head save-to-file-as may serve as an example and could be done more generically?

Also, my gut feeling is that I'd prefer not to move the mouse handling at this point. Maybe there is a chance to revamp this later. But right now we can just pass everything we need to the method.

I can elaborate more on this at a later point in time if need be, but I'm a bit short on spare time atm.

@RobertMueller2
Copy link
Copy Markdown
Member

RobertMueller2 commented Apr 30, 2026

I have one additional idea:

If you have a look at #385, when merged, this could allow an early exit trigger for the Undo action. Perhaps we could call it "undo-action-when-undo-stack-emtpy" (experimental) for lack of better description. This would achieve an UndoOrExit, but doesn't need an extra UndoOrExit action. If that explanation made sense :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Undo and UndoOrExit action variants for action chains

3 participants