Skip to main content

Module parse_incremental

Module parse_incremental 

Source
Expand description

Incremental-parse machinery: line-construct classification cache, damage-diff against the previous buffer snapshot, safe-boundary widening, and fence-range derivation. Pure functions only — no pulldown_cmark calls (those live in markdown.rs).

Enums§

LineConstructKind
Coarse classification of a buffer line for safe-boundary widening.
WidenResult
Result of widening a damaged range to safe construct boundaries.

Functions§

code_block_ranges_from_kinds
Line ranges of every code block (fenced AND indented) in the buffer, in ascending order. Reuses fence_ranges_from_kinds for fenced blocks (incl. unclosed-fence handling) and adds maximal IndentedCode runs. Used by the view to paint the code-box background.
compute_damage_range
Compute the row range that differs between old and new, with a cursor-row hint to accelerate the common single-character-edit case.
expand_to_reset_boundary
Expand damaged to the nearest reset boundaries on each side. A reset boundary is a row where pulldown-cmark’s parser state is provably reset (see ParsedBuffer::reset_boundaries), so the returned range is provably equivalent to a fresh parse over the same slice — no post-slice verification needed in release.
fence_ranges_from_kinds
Derive fence-range half-open intervals from the per-line construct kinds. The view layer uses these to decide which logical rows render force_raw (no markdown re-styling, code-block fg color).
widen_to_safe
Widen damaged outward to safe construct boundaries, applying D5’s +1 extra row and the D4 cap.