mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 06:02:42 +00:00
feat(tui): add undo support to Editor with the Ctrl+- hotkey
Undo snapshots are captured for all edit operations: - Word insertion, backspace, forward delete - Word/line deletion (Ctrl+W, Ctrl+U, Ctrl+K, Alt+D) - Yank/yank-pop, paste, autocomplete completion - Cursor movement starts a new undo unit - setText() pushes snapshot when content changes Additionally, history browsing captures the undo state on first entry.
This commit is contained in:
parent
c8db8e613f
commit
bacf334bc4
5 changed files with 595 additions and 8 deletions
|
|
@ -355,6 +355,7 @@ Both modes are configurable via `/settings`: "one-at-a-time" delivers messages o
|
|||
| Ctrl+K | Delete to end of line |
|
||||
| Ctrl+Y | Paste most recently deleted text |
|
||||
| Alt+Y | Cycle through deleted text after pasting |
|
||||
| Ctrl+- | Undo |
|
||||
|
||||
**Other:**
|
||||
|
||||
|
|
@ -405,6 +406,7 @@ All keyboard shortcuts can be customized via `~/.pi/agent/keybindings.json`. Eac
|
|||
| `deleteToLineEnd` | `ctrl+k` | Delete to line end |
|
||||
| `yank` | `ctrl+y` | Paste most recently deleted text |
|
||||
| `yankPop` | `alt+y` | Cycle through deleted text after pasting |
|
||||
| `undo` | `ctrl+-` | Undo last edit |
|
||||
| `newLine` | `shift+enter` | Insert new line |
|
||||
| `submit` | `enter` | Submit input |
|
||||
| `tab` | `tab` | Tab/autocomplete |
|
||||
|
|
|
|||
|
|
@ -3446,6 +3446,7 @@ export class InteractiveMode {
|
|||
const deleteToLineEnd = this.getEditorKeyDisplay("deleteToLineEnd");
|
||||
const yank = this.getEditorKeyDisplay("yank");
|
||||
const yankPop = this.getEditorKeyDisplay("yankPop");
|
||||
const undo = this.getEditorKeyDisplay("undo");
|
||||
const tab = this.getEditorKeyDisplay("tab");
|
||||
|
||||
// App keybindings
|
||||
|
|
@ -3481,6 +3482,7 @@ export class InteractiveMode {
|
|||
| \`${deleteToLineEnd}\` | Delete to end of line |
|
||||
| \`${yank}\` | Paste the most-recently-deleted text |
|
||||
| \`${yankPop}\` | Cycle through the deleted text after pasting |
|
||||
| \`${undo}\` | Undo |
|
||||
|
||||
**Other**
|
||||
| Key | Action |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue