Maniphest T80864

Undo fails with Python text editor operators while in edit-mode
Closed, ResolvedDESIGN

Assigned To
Campbell Barton (campbellbarton)
Authored By
Campbell Barton (campbellbarton)
Sep 17 2020, 2:25 AM
Tags
  • Text Editor
Subscribers
Campbell Barton (campbellbarton)
Germano Cavalcante (mano-wii)
Kai Jægersen (kaio)

Description

Currently running Python text editor operators in edit-mode uses the edit-mode undo system, instead of the text editor's undo.

This causes issues using Python operators in edit-mode, see: T80611


Possible solutions:

  • Always use the text editor's undo stack when running operators in the text editor.

    Doing this automatically is complicated by the need to initialize the undo state before edits are made.
  • Automatically use the text-editors's undo stack when it's modified.

    implementation is likely to be messy/involved.
  • Expose text editor undo begin/end to Python (ideally as a context manager).

    It would be nice to avoid manually dealing with the undo stack, noting this since it's one of the most straightforward solutions.

Event Timeline

Campbell Barton (campbellbarton) renamed this task from Python text editor operators to Undo with Python text editor operators.Sep 17 2020, 2:25 AM
Campbell Barton (campbellbarton) renamed this task from Undo with Python text editor operators to Undo fails with Python text editor operators while in edit-mode.
Campbell Barton (campbellbarton) changed the task status from Needs Triage to Confirmed.
Campbell Barton (campbellbarton) created this task.
Campbell Barton (campbellbarton) changed the subtype of this task from "Report" to "Design".
Campbell Barton (campbellbarton) moved this task from Backlog to Long Term on the Text Editor board.
Campbell Barton (campbellbarton) added subscribers: Kai Jægersen (kaio), Germano Cavalcante (mano-wii).
Campbell Barton (campbellbarton) closed this task as Resolved.Feb 22 2022, 10:47 AM
Campbell Barton (campbellbarton) claimed this task.

This has been resolved for some years now.