use more predictable rules for selecting which bracket to jump to and where

This commit is contained in:
Kay Simmons 2023-02-15 14:04:16 -08:00
parent 5041300b52
commit 0ba051a754
15 changed files with 457 additions and 217 deletions

View file

@ -452,8 +452,9 @@ fn end_of_document(map: &DisplaySnapshot, point: DisplayPoint, line: usize) -> D
fn matching(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint {
let offset = point.to_offset(map, Bias::Left);
if let Some((open_range, close_range)) =
map.buffer_snapshot.enclosing_bracket_ranges(offset..offset)
if let Some((open_range, close_range)) = map
.buffer_snapshot
.innermost_enclosing_bracket_ranges(offset..offset)
{
if open_range.contains(&offset) {
close_range.start.to_display_point(map)