pub struct IndentBlock {
pub col: u16,
pub start_line: u32,
pub end_line: u32,
}Expand description
One indent guide: a display column, and the inclusive line range it spans.
start_line is the region’s opener and end_line its closer, both
included. Neither is necessarily painted — IndentBlock::paints_on tests
that — but both belong to the range because the active block under a
cursor sitting on if c { is the block that line opens, and the block under
a cursor on the matching } is the one it closes. One range serves the
extent question and the membership question.
Fields§
§col: u16Display column the guide occupies.
start_line: u32Opener line, inclusive.
end_line: u32Closer line, inclusive.
Implementations§
Source§impl IndentBlock
impl IndentBlock
Sourcepub fn paints_on(&self, line: u32, line_depth: Option<u16>) -> bool
pub fn paints_on(&self, line: u32, line_depth: Option<u16>) -> bool
Whether this block’s guide is drawn on line.
The single predicate the whole feature rests on:
in range, and (the line is blank or the guide’s column is strictly left of where the line’s text starts).
The second arm is what keeps a guide out of a cell that holds text — on
fn f() { the column-0 guide fails 0 < 0, and on the matching } it
fails for the same reason. The first arm is what carries a guide through
a blank line inside a block.
Because the producer applies this before publishing, a published guide mark always lands on a blank cell, and no renderer needs a don’t-overwrite-text guard.
Trait Implementations§
Source§impl Clone for IndentBlock
impl Clone for IndentBlock
Source§fn clone(&self) -> IndentBlock
fn clone(&self) -> IndentBlock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for IndentBlock
Source§impl Debug for IndentBlock
impl Debug for IndentBlock
impl Eq for IndentBlock
Source§impl PartialEq for IndentBlock
impl PartialEq for IndentBlock
impl StructuralPartialEq for IndentBlock
Auto Trait Implementations§
impl Freeze for IndentBlock
impl RefUnwindSafe for IndentBlock
impl Send for IndentBlock
impl Sync for IndentBlock
impl Unpin for IndentBlock
impl UnsafeUnpin for IndentBlock
impl UnwindSafe for IndentBlock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.