Skip to main content

Module lines

Module lines 

Source
Expand description

Placing an edit by the lines of a source text (spec docs/superpowers/specs/2026-10-10-phase-3-4b-fixes-and-colour-design.md §4.7). Offsets are bytes. The rules step over ASCII only, so every offset they return is on a character boundary.

Functions§

arm_removal
What removing a match arm, bytes start..end, takes (spec §4.7): a comma after it and the spaces after that, and when nothing else shares its lines but a // comment ending them, those whole lines. None when anything but a comma, a // comment, a line ending, the text’s end or } follows the arm (plan decision 13).
ending
The text’s own line ending: \r\n when it holds one, else \n.
is_blank
Whether line holds only spaces, tabs and its line ending.
is_comment_line
Whether line’s first characters after spaces and tabs are //.
keyword_start
Where the keyword before the item name at byte name_start starts: fn, record, type, trait or const, with an async before fn (spec §4.7).
line_after
The edit adding line on a line of its own after the line holding byte at: where it goes, and what it inserts, in the text’s own ending.
line_before_item
The edit adding line and a blank line before the item starting at byte item_start, above the comment lines directly over it. A comment a blank line separates from the item stays above (spec §4.7).
line_start
Where the line holding byte at starts.
next_line_start
Where the line after the one holding byte at starts, or the text’s end.