on master help sign in
Avoid false positives in non-fuzzy bracket match
5dba649Pascal Kuthe
helix-core/src/match_brackets.rs+4−1
@@ -64,9 +64,12 @@ fn find_pair(syntax: &Syntax, doc: &Rope, pos: usize, traverse_parents: bool) ->
64 if end_byte == pos {
64 if end_byte == pos {
65 return Some(start_char);
65 return Some(start_char);
66 }
66 }
67+
67 // We return the end char if the cursor is either on the start char
68 // We return the end char if the cursor is either on the start char
68 // or at some arbitrary position between start and end char.
69 // or at some arbitrary position between start and end char.
70+ if traverse_parents || start_byte == pos {
69− return Some(end_char);
71+ return Some(end_char);
72+ }
70 }
73 }
71 }
74 }
72 // this node itselt wasn't a pair but maybe its siblings are
75 // this node itselt wasn't a pair but maybe its siblings are