Why it's harder than vim folds
Folds in a spreadsheet are different from vim folds because:
- Addressing must stay stable. If row 5 is hidden,
A6 still refers to the same data. Folds are purely a display concern, not a model concern. The core sheet must be untouched.
- Copy/paste interaction is non-obvious. Should
yy on a folded range yank visible-only or every-row? sc-im picks visible-only; we should too, but it's a real gotcha worth documenting.
- Selection across a fold. Visual mode
j over a fold should skip the hidden rows.
- CSV/
.cell write. Hidden rows must still serialize; folds are a view, not a filter.
Proposed scope
App.hidden_rows: BTreeSet<usize>, same for columns.
- Commands:
:hide row N, :hide col LABEL, :unhide all, :unhide row N.
- Vim-style normal-mode bindings:
zc hides the current row, zC hides the current column, zo reveals the nearest hidden neighbor, zR reveals all.
- Renderer skips hidden rows/cols and draws a thin marker between visible neighbors.
j/k skip hidden rows; h/l skip hidden columns. Same for visual selection extension.
- Yank/paste/save respect hidden state per the rules above (yank visible-only, save everything).
Open questions
- Persistence. Should folds survive
:e? Vim's foldmethod=manual loses them; we probably should too for v1.
- Range hide.
:hide rows 5-10? Easy and useful — include in v1.
- Outline-style multi-level folds. Out of scope; if anyone wants them, separate RFC.
Out of scope (v1)
- Persistent folds across
:e.
- Outline-style multi-level folds.
- Auto-hide-empty-rows.
Why it's harder than vim folds
Folds in a spreadsheet are different from vim folds because:
A6still refers to the same data. Folds are purely a display concern, not a model concern. The core sheet must be untouched.yyon a folded range yank visible-only or every-row? sc-im picks visible-only; we should too, but it's a real gotcha worth documenting.jover a fold should skip the hidden rows..cellwrite. Hidden rows must still serialize; folds are a view, not a filter.Proposed scope
App.hidden_rows: BTreeSet<usize>, same for columns.:hide row N,:hide col LABEL,:unhide all,:unhide row N.zchides the current row,zChides the current column,zoreveals the nearest hidden neighbor,zRreveals all.j/kskip hidden rows;h/lskip hidden columns. Same for visual selection extension.Open questions
:e? Vim's foldmethod=manual loses them; we probably should too for v1.:hide rows 5-10? Easy and useful — include in v1.Out of scope (v1)
:e.