Skip to main content

Module coords

Module coords 

Source
Expand description

Source byte → display column, in one place.

Three carriers hold the same two tables — CellRow (the cell path), DisplayLine (the display path), and the GPU peer’s per-row arrays — and every one of them has to answer the same question: given a source position, which column is it under?

Before conceal there was one term in that answer (inlay splices) and three copies of a four-line loop, which was survivable. With a second term the copies stop being survivable: an elision the cursor agrees with and the search highlight does not is a caret sitting off its own match, and the bug lives in whichever copy was not updated. So the arithmetic lands here once and the carriers delegate.

Design anchor: docs/dev/architecture/conceal.md.

Functions§

display_col_to_source_byte
Map a display column back to the source position under it — the inverse of source_byte_to_display_col, and what a mouse click needs.
source_byte_to_display_col
Map a source byte to its display column.
subtract_conceals
Remove the concealed columns lying before source_col from an otherwise-computed display column.

Type Aliases§

ConcealRange
A concealed source-byte range, [start, end).