Skip to main content

Module edit

Module edit 

Source
Expand description

What the chords do to a table: move between cells, and move, insert and delete rows and columns (TB.1).

Every operation here is a pure function from a Table and a caret to a new table and a new caret. Nothing touches a buffer; the mode turns the result into one Effect::ApplyEdit over the table’s line span.

One edit, not one per row. A column insert changes every line, and a half-applied column is a corrupt table — worse than either end state. It also means u undoes the operation rather than the last row of it.

The caret is tracked as a cell, not an offset. Alignment rewrites every row, so the byte the caret sat on does not survive; what the user means by “where I was” is the cell. Re-deriving the offset from the rendered line is the only way to land in the same place after the widths move.

Structs§

Cell
A caret inside a table: which row, and which cell in it.

Functions§

column_at
Which cell contains byte offset col on line.
offset_of_column
The byte offset of cell column’s first content character in line.