cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

Docs and a demo: wrapped text, row heights, borders, merged cells

Dami committed 7867877
A layout tape opens a trip plan and gives it a merged title, borders (a
thick outline, a double line under the headers) and wrapped notes from
the palette; formatting.md and the README show it, the README beside
the locale still. The architecture describes the engine's layout and
the grid's bands, ux.md how the layout reads without color, and the
roadmap lists it as shipped. Keystroke stress cases for the laid-out
shape.
commit
7867877752abf7090e8040089877a694219ff3be
parent
2def060eab32372cf7300c568f0cb9bb539ff7cb
author
Dami <dami.etoile@gmail.com>
kind
docs risk score 0.3 of 3, Jev's estimate
9 files changed, +110 -5
MREADME.md6+++-
MROADMAP.md2+-
Ademos/data/trip.01221+++++++++++
Ademos/layout.tape59++++++++++++++++++++++++++++++
Mdocs/contributing/architecture.md21+++++++++--
Mdocs/contributing/ux.md1+
Adocs/media/layout.gifbin
Mdocs/sheets/formatting.md2+
Minternal/ui/stress_test.go3++
M README.md +5 -1
M ROADMAP.md +1 -1
@@ -26,7 +26,6 @@ Sizes: S (a day or two), M (about a week), L (weeks).
2626 2727 | Item | Notes | Size |2828 |---|---|---|29-| Wrap text, row heights, borders, merged cells | Layout changes in the grid renderer | M to L |3029 | Locale, what's left: month and day names in the locale's language (`mmm`, `dddd`), Excel downloads with the locale's Currency and Date formats | The rest follows the locale: [Locale](docs/sheets/locale.md) | S |3130 3231 ### 3. Scale
@@ -73,6 +72,7 @@ by a gateway dialing the iroh ticket.
7372 - Undo and redo for every change, across sheets: [Editing](docs/sheets/editing.md#undo)7473 - Copy, cut, paste and fill with relative and `$absolute` references; insert and delete rows and columns: [Editing](docs/sheets/editing.md#copy-paste-and-fill)7574 - Entries detected as typed (currency, percent, dates, times) and number formats: [Formulas](docs/formulas/README.md#what-you-type)75+- Wrapped and clipped text, row heights, borders and merged cells, in `.012` files and XLSX both ways: [Formatting](docs/sheets/formatting.md#wrapping)7676 - Named ranges; several sheets with references between them, hidden sheets: [References](docs/formulas/references.md)7777 - Sheets' everyday, math, text, lookup, date and finance functions, checked against excelize: [Functions](docs/reference/functions.md), [Testing](docs/contributing/testing.md#the-excelize-oracle)7878 - Dynamic arrays that spill (FILTER, SORT, UNIQUE, SEQUENCE and more, ARRAYFORMULA), LET and LAMBDA, SPLIT and the REGEX functions: [Arrays and spills](docs/formulas/arrays.md)
A demos/data/trip.012 +21 -0
A demos/layout.tape +59 -0
M docs/contributing/architecture.md +18 -3
@@ -130,6 +130,15 @@ style.
130130 changing recalculates the formulas reading any cell of it, found through131131 the dependency indexes (`linereaders.go`), so they infer their format132132 from blank cells too.133+- **Layout.** A cell's style holds how its text wraps and the lines on134+ its edges (`borders.go`), so both fall back on lines and travel with135+ copies. Rows' heights set by hand are kept per sheet as column widths136+ are, and merged ranges in the view state, replaced whole, so undo, the137+ file and inserted lines follow them (`rowlayout.go`, `merge.go`, which138+ finds a cell's merge through an interval index). Cells whose own style139+ wraps or draws borders are indexed by row, so the grid measures the140+ rows it shows at their cost, and a sheet with none of these (not141+ `Shaped`) is drawn a line per row without asking.133142 - **Parsing.** `internal/formula`'s hand-written Pratt parser turns134143 formulas into an AST, keeping absolute markers so references can be135144 rewritten when cells move. Its printer turns ASTs back into text in
@@ -342,7 +351,7 @@ draw. The components:
342351 343352 | Component | Type | Owns |344353 |---|---|---|345-| grid (embedded) | `grid` | the sheet shown, active cell, scroll, window size, selection; mapping rows and columns to the screen, frozen panes, moving and selecting (`grid.go`, `panes.go`, `selection.go`) |354+| grid (embedded) | `grid` | the sheet shown, active cell, scroll, window size, selection; mapping rows and columns to the screen (rows as bands of lines, `bands.go`), frozen panes, moving and selecting (`grid.go`, `panes.go`, `selection.go`) |346355 | edit line | `lineedit.Line` | the one-line editor shared by cell entries, prompts and search fields (package `lineedit`) |347356 | cell entry | `entry`, `assist` | typing into a cell, pointing at references, other sheets while pointing, formula suggestions and signatures (`entry.go`, `assist.go`) |348357 | prompt | `prompt` | a question on the context line, typed or pointed at (`prompt.go`) |
@@ -393,8 +402,14 @@ goes through `runCommand`, so macros record them and pivots guard them.
393402 the grid rows and the status line, then composites the floating layers394403 with Lip Gloss: charts over the grid, then the open overlay's boxes or the395404 formula suggestions, so the grid never shifts under them. Only the visible396-cells are rendered; `rowtext` lays out each row's text in one pass over397-the cells that can reach the screen. Styles come from `theme`, a small set405+cells are rendered; `rowtext` lays out each line of a row's text in one406+pass over the cells that can reach the screen. A row is a band of lines407+(`bands.go`): a rule line when a border lies along its top, then as many408+lines as its height or the text it wraps takes (`rowtext.Shapes`, kept409+until the sheet changes); navigation, the mouse and charts map rows to410+lines through the bands. Borders, merged cells and the rule lines are411+drawn over the laid-out text (`gridlines.go`), with what a frame has412+drawn in each role kept for the rest of it. Styles come from `theme`, a small set398413 of roles with dark and light variants on the terminal's 16 ANSI colors,399414 so the user's palette applies; its widgets (framed boxes, key chips, key400415 hints) are what every overlay is drawn with.
M docs/contributing/ux.md +1 -0
A docs/media/layout.gif +0 -0

Binary file.

M docs/sheets/formatting.md +2 -0
M internal/ui/stress_test.go +3 -0