diff options
author | Pascal Kuthe | 2023-06-05 23:37:36 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-06-22 07:00:08 +0000 |
commit | 5dba649d81d706125e16fa695747ed936e7b105a (patch) | |
tree | 115a2f4d3100a5c8d5501d16f234a5209775e514 /helix-core/src | |
parent | 37058e0401e1b241e3d8ad1cfc1d5362cd83e19e (diff) |
Avoid false positives in non-fuzzy bracket match
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/match_brackets.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/helix-core/src/match_brackets.rs b/helix-core/src/match_brackets.rs index 01deb82c..434df904 100644 --- a/helix-core/src/match_brackets.rs +++ b/helix-core/src/match_brackets.rs @@ -64,9 +64,12 @@ fn find_pair(syntax: &Syntax, doc: &Rope, pos: usize, traverse_parents: bool) -> if end_byte == pos { return Some(start_char); } + // We return the end char if the cursor is either on the start char // or at some arbitrary position between start and end char. - return Some(end_char); + if traverse_parents || start_byte == pos { + return Some(end_char); + } } } // this node itselt wasn't a pair but maybe its siblings are |