Vim's r{char} overwrites a single character without entering insert mode. The cleanest sheet equivalent overwrites the entire cell, since cells are atomic.
Design questions
- Replace whole cell vs first character? Whole cell is more useful (acts like a fast "type one digit") and matches the spreadsheet "cells are atomic" model. Recommend whole cell.
- Numbers.
r5 should produce a numeric 5, going through the same auto-detect as plain edits.
- Visual range.
r5 over a visual selection should fill every selected cell with 5 (vim semantics).
Scope (assuming whole-cell replacement)
NormalState pending = Some('r') consumes one char.
- Dispatches
Action::EditCell(pos, char.to_string()).
- In visual modes: dispatches a new
Action::FillRange { start, end, raw } that goes through the standard edit pipeline so the dep graph stays consistent (one undo entry, one recalc).
Tests
- Cell
"hello", press r5 → cell holds numeric 5.
- Visual range,
r0 → every cell becomes 0, all in one undo entry.
Esc after r aborts cleanly.
Out of scope
R (replace mode) — that's an Insert-mode variant; deserves its own issue if anyone wants it.
Vim's
r{char}overwrites a single character without entering insert mode. The cleanest sheet equivalent overwrites the entire cell, since cells are atomic.Design questions
r5should produce a numeric5, going through the same auto-detect as plain edits.r5over a visual selection should fill every selected cell with5(vim semantics).Scope (assuming whole-cell replacement)
NormalStatepending = Some('r')consumes one char.Action::EditCell(pos, char.to_string()).Action::FillRange { start, end, raw }that goes through the standard edit pipeline so the dep graph stays consistent (one undo entry, one recalc).Tests
"hello", pressr5→ cell holds numeric5.r0→ every cell becomes0, all in one undo entry.Escafterraborts cleanly.Out of scope
R(replace mode) — that's an Insert-mode variant; deserves its own issue if anyone wants it.