NS8 slice: Ship core editing, undo, redo, save, and quit safety #46

Closed
opened 2026-06-21 09:12:12 +00:00 by tmk241 · 1 comment
Owner

OBJECTIVE: A user can perform ordinary code edits in the real editor loop: move, insert, append/open lines, delete/change/replace/yank/paste text, undo/redo, save, and quit safely.

AUTHORITY: Parent #43; KEYMAP.md Core Normal bindings and Editing operations; req: coding/001, input/001-007, testing/001-004.

AGENT AUTHORITY:

  • Delivery authority: local-commit
  • Tracker authority: this issue may be commented and closed when acceptance passes; parent #43 may be commented/checklisted.
  • Handoff state: committed clean, tracker commented/closed.

PARENT: #43 via explicit issue link and parent checklist.

SCOPE: Buffer mutation model, cursor/movement commands, UTF-8/cell-width preservation, undo/redo log, clipboard/yank buffer if local, save/dirty state, quit confirmation, replay tests. Likely files: src/tui.zig, src/session.zig, src/protocol.zig, src/input.zig.

BOUNDARIES: Keep operations local and deterministic. Do not add system clipboard integration unless already available as a platform primitive. Do not add macro recording, multi-cursor, or ex commands.

ACCEPTANCE:

  • i, a, o, and open-above path enter Insert at the correct location.
  • Movement by character, line, word, line start/end, and panel aliases works in Normal without breaking UTF-8 boundaries.
  • dd, cc, delete/change with a simple motion/object, r, y, and p work against regular and boundary cases.
  • Undo and redo restore cursor, buffer text, dirty state, and UTF-8 content correctly.
  • Save writes exactly the intended bytes and reports failure without data loss on invalid/unwritable paths.
  • Quit refuses accidental loss when dirty and exits cleanly when clean or explicitly confirmed.

VERIFICATION:

  • zig build test
  • Replay/headless tests for ASCII, multi-byte UTF-8, combining/wide-cell text if supported, file start/end boundaries, unwritable save, dirty quit, undo/redo across multiple edits.
  • zig build v1-smoke

BLOCKERS: none.

OBJECTIVE: A user can perform ordinary code edits in the real editor loop: move, insert, append/open lines, delete/change/replace/yank/paste text, undo/redo, save, and quit safely. AUTHORITY: Parent #43; KEYMAP.md `Core Normal bindings` and `Editing operations`; req: coding/001, input/001-007, testing/001-004. AGENT AUTHORITY: - Delivery authority: local-commit - Tracker authority: this issue may be commented and closed when acceptance passes; parent #43 may be commented/checklisted. - Handoff state: committed clean, tracker commented/closed. PARENT: #43 via explicit issue link and parent checklist. SCOPE: Buffer mutation model, cursor/movement commands, UTF-8/cell-width preservation, undo/redo log, clipboard/yank buffer if local, save/dirty state, quit confirmation, replay tests. Likely files: `src/tui.zig`, `src/session.zig`, `src/protocol.zig`, `src/input.zig`. BOUNDARIES: Keep operations local and deterministic. Do not add system clipboard integration unless already available as a platform primitive. Do not add macro recording, multi-cursor, or ex commands. ACCEPTANCE: - `i`, `a`, `o`, and open-above path enter Insert at the correct location. - Movement by character, line, word, line start/end, and panel aliases works in Normal without breaking UTF-8 boundaries. - `dd`, `cc`, delete/change with a simple motion/object, `r`, `y`, and `p` work against regular and boundary cases. - Undo and redo restore cursor, buffer text, dirty state, and UTF-8 content correctly. - Save writes exactly the intended bytes and reports failure without data loss on invalid/unwritable paths. - Quit refuses accidental loss when dirty and exits cleanly when clean or explicitly confirmed. VERIFICATION: - `zig build test` - Replay/headless tests for ASCII, multi-byte UTF-8, combining/wide-cell text if supported, file start/end boundaries, unwritable save, dirty quit, undo/redo across multiple edits. - `zig build v1-smoke` BLOCKERS: none.
tmk241 added the sliceready-for-agentgoal labels 2026-06-21 09:12:12 +00:00
Author
Owner

Completed in commit a08ee02 (Add core editing commands).

What changed:

  • Added session/protocol commands for vertical movement, word movement, line start/end, delete-forward, line delete/change, open line above/below, and character replace.
  • Added TUI core-editing bindings for Normal/Insert paths: a, o, O, dd, cc, dh/dl, ch/cl, yy, p, r, u, U, 0, $, w/b/e, arrows, and mutating backspace.
  • Added client-local undo/redo stacks and yank register with snapshot restoration.
  • Added tests for line/word movement, UTF-8 replace/delete/open-line behavior, delete/yank/paste, undo/redo, change/replace/open-line flows, invalid UTF-8 replace, and undo preservation.

Verification:

  • zig fmt src/session.zig src/protocol.zig src/tui.zig && zig build test
  • zig build
  • zig build v1-smoke
  • zig build run -- --help
  • zig build run -- src/main.zig
  • redgate lint /opt/repositories/mim/REQUIREMENTS.md && redgate health /opt/repositories/mim/REQUIREMENTS.md

Notes:

  • This closes the core editing/undo/save/quit-safety slice. Rich text-object composition remains scoped to #47; full file/tree panels remain scoped to #49.
Completed in commit a08ee02 (`Add core editing commands`). What changed: - Added session/protocol commands for vertical movement, word movement, line start/end, delete-forward, line delete/change, open line above/below, and character replace. - Added TUI core-editing bindings for Normal/Insert paths: `a`, `o`, `O`, `dd`, `cc`, `dh/dl`, `ch/cl`, `yy`, `p`, `r`, `u`, `U`, `0`, `$`, `w/b/e`, arrows, and mutating backspace. - Added client-local undo/redo stacks and yank register with snapshot restoration. - Added tests for line/word movement, UTF-8 replace/delete/open-line behavior, delete/yank/paste, undo/redo, change/replace/open-line flows, invalid UTF-8 replace, and undo preservation. Verification: - `zig fmt src/session.zig src/protocol.zig src/tui.zig && zig build test` - `zig build` - `zig build v1-smoke` - `zig build run -- --help` - `zig build run -- src/main.zig` - `redgate lint /opt/repositories/mim/REQUIREMENTS.md && redgate health /opt/repositories/mim/REQUIREMENTS.md` Notes: - This closes the core editing/undo/save/quit-safety slice. Rich text-object composition remains scoped to #47; full file/tree panels remain scoped to #49.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tmk241/mim#46