Skip to main content

Module change

Module change 

Source
Expand description

Mapping a position forward through edits that have already been applied.

This is the one thing in the tree that knows how a position moves when the text before it changes. It lived inside the editor panel, private, which meant every consumer that holds a position across an edit — search results, diagnostics, git hunks — would have had to rediscover it.

This is a shift map, not an anchor system. It maps positions forward through one batch of edits, in the order those edits were applied, and is then discarded. Zed’s Anchor and Neovim’s extmarks survive arbitrary later edits because the buffer tracks them; nothing here does. That is enough for every consumer named above, and it is what the code already did correctly.

ponytail: when something needs a position to survive an arbitrary edit sequence rather than one batch, that is anchors, and anchors are a separate decision — not an extension of this.

Structs§

Shift
The accumulated effect of edits already applied, in original coordinates.