Skip to main content

line_start

Function line_start 

Source
pub fn line_start(text: &str, offset: usize) -> usize
Expand description

Start of the logical line holding offset — the byte after the previous newline.

Logical, not visual: with soft wrapping these two readings diverge, and ctrl-a here goes to the start of the whole paragraph rather than stopping at the wrap. That is emacs’ C-a, and a deliberate divergence from macOS NSTextView, which stops at the visual row. On text with no newline — every Shape::Line field — the two are identical.