Skip to content

frontend: undo_stack::enable_internal() enables Undo on an empty stack #2222

Closed

Description

@zackees

Found in the #2214 research (docs/undo-redo-research-2214.md, PR #2221).

frontend/utility/undo_stack.cpp.hpp:113-120: enable_internal() always calls actionMainUndo->setDisabled(false). Redo, by contrast, is enabled only when redo_items.size() > 0. So after any disable()/enable() span, Undo is enabled with nothing to undo. It shows today as a live Edit → Undo item that does nothing, and a visible toolbar button (#2214) would advertise this.

Plan

  1. RED: a frontend test that creates the stack with the UI actions, runs disable() then enable() on an empty stack, and asserts that actionMainUndo stays disabled.
  2. GREEN: in enable_internal(), guard Undo on undo_items.size() > 0, as Redo already is.

This is a prerequisite for the Undo/Redo toolbar button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions