Add Vim undo to the TUI composer (#41941)

## Why

Composer drafts include attachments, mention targets, and deferred paste payloads in addition to visible text. Vim undo needs to restore that complete state as a single edit.

## What changed

- Add bounded, draft-level Vim undo history, with `u` as the configurable default binding in normal mode.
- Group complete Vim commands and insert sessions into undo steps, including direct composer changes such as pastes and attachments.
- Preserve undo, repeat, and search state when a reverse-history preview is canceled, and start fresh history when another prompt is accepted.

## Testing

- Cover grouped edits, custom bindings, history and search interactions, attachments, and large paste payloads.

GitOrigin-RevId: 12ecdb3c34a2d66f5d856aa2f82dc15bd91b230b
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-01 00:21:22 +00:00
1 parent c5a3700dd7
commit 9c7edd4bc3
22 files changed
+773 -26

No files matched your search

+10
View File
@@ -3902,6 +3902,7 @@
"substitute_char": null,
"till_backward": null,
"till_forward": null,
"undo": null,
"yank_line": null
},
"vim_operator": {
@@ -4728,6 +4729,7 @@
"substitute_char": null,
"till_backward": null,
"till_forward": null,
"undo": null,
"yank_line": null
}
},
@@ -5246,6 +5248,14 @@
],
"description": "Stop before the next character on the current line (`t`)."
},
"undo": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Undo the last complete edit (`u`)."
},
"yank_line": {
"allOf": [
{