Add text positions for mapping Markdown rows between layouts.
Review Request #15467 — Created Nov. 4, 2026 and updated
Comments on the rendered view of Markdown attachments store row numbers.
I'm going to be changing the row layout to be block-based, and comments
made on the old layout will need to remap to the matching rows of the
new one.This change adds two new helpers for this:
-
get_row_text_ranges()returns where each row's text sits in the
whole document. Whitespace isn't counted, so different layouts of the
same Markdown line up. Images and horizontal rules count as one
character, and each line of code gets one extra character so empty
lines still have a position. -
map_text_ranges()maps each row of one layout to the rows of another
that its text overlaps. This handles rows that were merged (lines of a
paragraph) and rows that were split (rows of a table). Rows without
text map to the row before them.
Nothing uses these yet.
Ran unit tests.
| Summary | ID |
|---|---|
| unouzrssoulxkxtzqxrtmmxmpqpxpsxr |