Panics · P17 Editor: owner offsets ride the text's edits, stale ranges, rows and globs log instead of panicking
This commit is contained in:
1 parent
f0b7f779f6
commit
b29d66ccc0
13 files changed
+489
-83
No files matched your search
+3
-3
@@ -150,14 +150,14 @@ impl CodeEditor {
|
||||
});
|
||||
}
|
||||
|
||||
/// The row the primary cursor draws on.
|
||||
/// The row the primary cursor draws on, or the fold header above it when a fold hides it.
|
||||
pub(crate) fn primary_row(&self) -> usize {
|
||||
let line = self.buffer.line_of(self.primary().head);
|
||||
let hide = hidden(self.buffer.lines(), &folds(&self.buffer), &self.folded);
|
||||
rows(&self.buffer, &hide, &self.marks)
|
||||
.iter()
|
||||
.position(|row| *row == Row::Line(line))
|
||||
.expect("the primary cursor sits on a shown line")
|
||||
.rposition(|row| matches!(row, Row::Line(shown) if *shown <= line))
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
/// Scrolls the primary cursor into view: from below when moving down, from above when moving up.
|
||||
|
||||
Reference in new issue
Block a user