Maniphest T71735

Text editor undo system, undo step grouping behavior
Confirmed, NormalDESIGN

Assigned To
Campbell Barton (campbellbarton)
Authored By
Campbell Barton (campbellbarton)
Nov 21 2019, 5:33 PM
Tags
  • Text Editor
  • Papercut
Subscribers
Campbell Barton (campbellbarton)
Kai Jægersen (kaio)
Matheus Santos (MatheusSantos)
Valentin (Poulpator)
William Reynish (billreynish)
Tokens
"Like" token, awarded by billreynish.

Description

This design task is to resolve how to handle undo steps in the text editor (and possible text fields in the future).

Possible options:

  • Keep current behavior - each key is a single unto step.
  • Group by character type / action.
  • Group using a timer, so characters typed in quick succession are put into a single undo step.

    The timer can be a preference, so users who type slowly or prefer to have the current behavior can either increase the timer or set it to zero.

Note:

  • Using a timer may be unpredictable especially when the users typing speed hovers around the limit - undo groupings may seem unpredictable.
  • Using whole words may have the disadvantage that large blocks get undone (not fine grained enough).
  • Having grouped undo makes it difficult to test undo/redo (developer detail, even so - noting it here).

Proposal

  • Undo grouping will only be done for single character insertion/removal.
  • Undo wont group edits separated by cursor motion.
  • Word level grouping has the same delimiters as pressing Ctrl-Left/Right, this means whitespace/punctuation & alpha-numeric characters will be undone/redone in blocks.
  • Have a preference for the text editor to group undo by words or characters. (this allows undo testing code to behave predictably).

Maybe there are other options, @William Reynish (billreynish) we discussed this a while ago.

Creating because D6283: Add undo grouped to Insert and Delete text operator was submitted which.

Event Timeline

Campbell Barton (campbellbarton) created this task.Nov 21 2019, 5:33 PM
Campbell Barton (campbellbarton) mentioned this in T68061: Text Editor Module.
Campbell Barton (campbellbarton) mentioned this in D6283: Add undo grouped to Insert and Delete text operator.Nov 21 2019, 5:36 PM
Valentin (Poulpator) added a subscriber: Valentin (Poulpator).Nov 21 2019, 7:08 PM
Campbell Barton (campbellbarton) updated the task description.Nov 22 2019, 1:49 AM
Campbell Barton (campbellbarton) updated the task description.Nov 22 2019, 3:43 AM
Campbell Barton (campbellbarton) updated the task description.
Campbell Barton (campbellbarton) updated the task description.
Campbell Barton (campbellbarton) updated the task description.Nov 22 2019, 3:46 AM
Campbell Barton (campbellbarton) updated the task description.Nov 22 2019, 3:53 AM
William Reynish (billreynish) awarded a token.Nov 22 2019, 4:33 AM
Campbell Barton (campbellbarton) moved this task from Backlog to Papercuts on the Text Editor board.Jun 20 2020, 4:46 AM
Campbell Barton (campbellbarton) added a project: Papercut.
Campbell Barton (campbellbarton) moved this task from Papercuts to Long Term on the Text Editor board.Jun 20 2020, 4:54 AM
Kai Jægersen (kaio) added a subscriber: Kai Jægersen (kaio).Sep 12 2020, 1:18 AM
Matheus Santos (MatheusSantos) added a subscriber: Matheus Santos (MatheusSantos).Nov 13 2021, 2:00 PM
Matheus Santos (MatheusSantos) added a comment.Nov 13 2021, 2:06 PM

I would propose a two level undo for the text editor. While typing a word, all characters are temporarily stacked as undo steps, as soon as an special character is added, this temporary undo stack is flattened into a single undo and added to the main undo stack, also, it would initialize the new stack for the new word.