mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 13:10:54 +00:00
Don't underflow when calling symbols_containing_offset(0)
This commit is contained in:
parent
d7a39a2116
commit
bfa5dd52dd
1 changed files with 2 additions and 1 deletions
|
@ -1684,7 +1684,8 @@ impl BufferSnapshot {
|
|||
theme: Option<&SyntaxTheme>,
|
||||
) -> Option<Vec<OutlineItem<Anchor>>> {
|
||||
let position = position.to_offset(&self);
|
||||
let mut items = self.outline_items_containing(position - 1..position + 1, theme)?;
|
||||
let mut items =
|
||||
self.outline_items_containing(position.saturating_sub(1)..position + 1, theme)?;
|
||||
let mut prev_depth = None;
|
||||
items.retain(|item| {
|
||||
let result = prev_depth.map_or(true, |prev_depth| item.depth > prev_depth);
|
||||
|
|
Loading…
Reference in a new issue