Skip to main content

indent_guide_level

Function indent_guide_level 

Source
pub fn indent_guide_level(
    own: Option<u32>,
    above: Option<u32>,
    below: Option<u32>,
    indent_size: u32,
) -> u32
Expand description

Indentation depth (in guide levels) for one row — the number of indent guides drawn to its left.

A content row’s level is ceil(indent / indent_size), where own is its leading-whitespace width in display cells. A blank row (own = None) has no indent of its own, so its level is interpolated from the nearest non-blank rows above / below (their widths in cells): the blank inherits the deeper neighbour’s ladder, biased so a dedent still shows the outgoing level. This is the convention for brace-delimited languages, where whitespace does not open or close a block. A row at the top/bottom edge of the file (one neighbour missing) is level 0. The guides drawn are at levels 1..=level, i.e. cells 0, indent_size, …, (level-1)*indent_size.