Fix crash when querying for enclosing brackets at EOF
This commit is contained in:
parent
0588360bf0
commit
0777af1dd3
2 changed files with 11 additions and 1 deletions
|
@ -571,6 +571,15 @@ fn test_enclosing_bracket_ranges(cx: &mut MutableAppContext) {
|
|||
Point::new(3, 4)..Point::new(3, 5)
|
||||
))
|
||||
);
|
||||
|
||||
// Regression test: avoid crash when querying at the end of the buffer.
|
||||
assert_eq!(
|
||||
buffer.enclosing_bracket_point_ranges(buffer.len() - 1..buffer.len()),
|
||||
Some((
|
||||
Point::new(0, 6)..Point::new(0, 7),
|
||||
Point::new(4, 0)..Point::new(4, 1)
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue