Skip to content

Add Undo and UndoOrExit action variants for action chains #485

Description

@clansty

Description

Add undo and undo-or-exit as new action variants that can be used in action chains (actions-on-enter, actions-on-escape, actions-on-right-click, etc.).

  • undo: Plain action that undoes one step. No-op if nothing to undo, continues the chain regardless.
  • undo-or-exit: Compound action — undoes one step if possible; if nothing to undo, exits the application. This enables the common "right-click to undo, or exit when done" workflow used by tools like Snipaste and PixPin.

Use case

Right-click-to-undo is a common interaction pattern in annotation/drawing tools. Combined with undo-or-exit, users can configure --actions-on-right-click undo-or-exit for a natural "undo or cancel" flow.

Implementation notes

  • A new process_actions method handles Undo/UndoOrExit before passing remaining actions to the render pipeline.
  • Enter/Escape/right-click are routed through process_actions so Undo works consistently in all action chains.
  • No implicit control flow — the compound behavior is explicit in the undo-or-exit action name.

Related discussion: #481

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions