Undo granularity should be by word or action, not by character
Aliases: undo grain · word-level undo · undo chunk
What it is
Undo in text should rewind one meaningful edit: the word just typed, the block just pasted, the sentence just deleted—not fifty per-character steps carved out of a burst. Too fine, and undo is expensive backspace. Too coarse, and one undo takes edits the user still wants. The right boundary is what the user would call “the thing I just finished.”
Why it happens
People perceive a burst of keystrokes as one chunk (a word, a paste) and perceive pauses, spaces, and focus moves as boundaries. If the undo stack pushes raw key events, depth equals keystroke count, one undo emits one letter, and the expert shortcut’s advantage is eaten by repetition. If the whole session is one item, undo equals clear. A practical cut watches inter-key gaps and operation type: a run of letters becomes “typed a word”; paste, cut, and select-all-delete are their own items; arrow movement usually does not push. When the cut matches “the last step” in working memory, people can predict what a press will drop. Backspace is a different stack: it deletes characters in the document and need not pop an undo item. Merging backspace and undo into one gesture collapses the grain model.
Studying it
Have people type a passage, paste in the middle, change a few words, then use only undo to reach a specified mid-state. Log how many presses and whether they overshoot. Independent variables include cut rule (per character / per word / per pause / per command) and pause threshold. Dependent measures include count, overshoot into content they wanted to keep, and reports of “was that my last step?” Scoring only “can they reach the start” lets per-character undo pass, slowly.
Where it stops holding
Edits that must be letter-exact (one letter inside a typo) need fine grain; word-level undo then overshoots and should still be refinable inside the word. A programmatic bulk replace is one item even if it feels like “many places.” In collaborative editing, other people’s actions should not enter my undo stack. While an IME composition is uncommitted, undo targets the composition string, not committed words; the cut rule differs.
Applying it
- Chunk a key burst into word-level items on pauses and whitespace; record paste, cut, and replace as their own items; avoid key-level pushes.
- Make one undo’s visible result match a spoken “last step.” If the user says “I only wanted that paste gone” and a previously typed word vanishes too, the cut is too coarse.
- Accept with “type three words—paste—type two more—undo to before the paste.” The target is one or two undos, not a character count.