Skip to content

sheetsui

sheetsui (a.k.a. sheetui) is a terminal spreadsheet, explicitly “inspired by sc-im and vim,” written in Rust. Its distinguishing architectural choice is that it does not implement its own spreadsheet engine — it delegates formulas, cell evaluation, and xlsx compatibility to ironcalc, a separate Rust crate, and keeps its own codebase focused on the TUI and the modal keyboard layer. So sheetsui is, in effect, a vim-modal Ratatui skin over a headless spreadsheet engine — the cleanest example in this cluster of the engine-as-library / UI-as-separate-layer split.

The interaction is fully modal, with four named modes: Navigation (default), CellEdit (editing), range-selection (visual), and Command (: colon commands). Context-sensitive help is always one keystroke away (Alt-h).

  • The engine/UI split is the headline. ironcalc owns formulas, evaluation, dependency tracking, and xlsx import/export; sheetsui owns rendering and input. This is the same separation KN-86 wants between the Fe VM + nOSh model layer and the display/oled/input layer — and sheetsui is a tidy, small Rust demonstration that a complex calc core can be a dependency rather than tangled into the render loop. The lesson is structural, not code-portable (KN-86 is C/SDL3, not Rust/ironcalc): the table/calc engine should be a callable module, not woven into the frame loop. Echoes the same split in loglens-core (headless engine) and csvlens (run_csvlens() library form).
  • Modal editing with a tight, learnable keymap. Navigation/CellEdit/Visual/Command is the minimal four-mode set, and sheetsui’s bindings are conventional and small: hjkl move (with TAB=left, Enter=down for tab-through data entry), e/i enter CellEdit, o/O insert-row-below/above-and-edit, v or Ctrl-r enter range selection, gg to column top, Ctrl-n/Ctrl-p next/previous sheet, : for Command mode, d/D delete cell contents (D includes style), y/p copy/paste, Ctrl-s save, q quit. The TAB-moves-left / Enter-moves-down convention is a nice data-entry ergonomic worth noting for any KN-86 form/table cart.
  • o/O insert-and-edit as a one-key affordance. “Insert a row and immediately start editing it” collapses two operations into one keystroke — a good pattern for KN-86’s small key budget, where every key that does two useful things is a win.
  • Multi-sheet navigation (Ctrl-n/Ctrl-p). A cheap, linear sheet-switcher. KN-86’s analog is tab/surface switching in the Bare Deck Terminal (STATUS / CIPHER / LAMBDA / LINK / SYS) — sheetsui’s linear Ctrl-n/Ctrl-p cycle is one model for that, simpler than visidata’s full sheet-stack.

sheetsui’s d vs D distinction is itself instructive: d deletes contents leaving style untouched, D deletes contents including style — meaning the app has a per-cell style layer (color, bold, etc.) separate from contents. On KN-86 that style layer collapses to the monochrome toolkit:

  • Cell style → inversion / box-drawing / block-density. Where sheetsui would color or embolden a cell, KN-86 substitutes inversion (black-on-amber), a bracket/box frame, or an inline block-bar for magnitude. The contents-vs-style split is still meaningful — a KN-86 cell can carry an “emphasis” attribute that renders as inversion rather than hue.
  • Mode indication → text token in Row 0. NAV / EDIT / VISUAL / CMD spelled out, plus the cursor’s colrow address. No colored mode indicator needed.
  • Cursor / range → inverted region, shape conveying row vs column vs cell as in csvlens.
  • Sheet tabs → positional + inversion. The active sheet’s name inverts in a Row-0 tab strip; inactive sheets render normal-weight. Position + inversion, no color.

Nothing structural in sheetsui depends on color; the only color-dependent layer is per-cell style decoration, which maps onto KN-86’s inversion + density vocabulary one-for-one.

sheetsui itself doesn’t embed a scripting language (it leans on ironcalc’s formula language for computation), so the Lisp angle here is indirect but worth stating: ironcalc is the “formula engine as a dependency” that, on KN-86, the Fe VM would be. Where sheetsui calls ironcalc to evaluate =SUM(A1:A10), a KN-86 table cart would call the Fe VM to evaluate a Lisp expression over a cell range — (reduce + (range-cells a1 a10)). The architectural takeaway is the same one sc-im makes explicitly: keep the evaluation engine separable and callable. sheetsui demonstrates the clean version of that (engine is a third-party crate); sc-im demonstrates the embedded-interpreter version (Lua bolted in). KN-86 sits closer to sc-im (Fe is embedded, not a remote dependency) but should aim for sheetsui’s cleanliness of separation.

  • Batch 8. Captured primarily for the engine/UI separation lesson — the single cleanest example in the cluster of a calc core as a swappable dependency.
  • Cross-link sc-im.md — sheetsui’s stated inspiration; sc-im is the embedded-interpreter version, sheetsui the engine-as-dependency version. Read them as a pair on “where does the compute live.”
  • Cross-link csvlens.md — both are Rust/Ratatui, both expose a library form; csvlens views, sheetsui edits.
  • Cross-link loglens-core.md — same headless-engine principle from the log-query side.
  • README and docs are thin; modal model and keymap pulled from docs/navigation.md and docs/index.md. ironcalc is the part to read if validating the dependency-split argument.