Skip to content

RFC: row/column hiding (zc / zo / zR-style folds) #42

Description

@garritfra

Why it's harder than vim folds

Folds in a spreadsheet are different from vim folds because:

  1. 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.
  2. 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.
  3. Selection across a fold. Visual mode j over a fold should skip the hidden rows.
  4. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionOpen-ended design discussionenhancementNew feature or requestrfcRequest For Comment — design proposalvimVim modal editing

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions