Typing over a selection composed two edits in Lua — delete_region() + insert_char() — so it recorded two undo steps: one undo left the half-replaced text, two restored the original. Undo granularity is per apply_edit in both modes (v0.1 pushes one UndoEntry per edit; CRDT commits per edit via export and groups by commit, with record_checkpoint unused), so the fix is to make type-over one edit. New core EditorCore::insert_char_over_region emits a single EditOp::Replace when a region is active (cursor past the inserted bytes, selection cleared) and delegates to insert_char otherwise. The three type-over commands (buffer.newline / tab / self-insert) call it via a new Lua binding instead of the delete+insert pair. delete_region and insert_char are unchanged for their other callers; region-aware backspace/delete already emit one op. Verified one undo unit in BOTH modes (dual_mode replace_is_a_single_undo_step covers v01 + crdt — a CRDT Replace is delete-then-insert internally but one commit) plus an end-to-end acceptance test through the key-dispatch path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| api | ||
| commands | ||
| hooks | ||
| keymaps | ||
| packages/repl | ||
| runtime | ||