@@ -64,9 +64,12 @@ fn find_pair(syntax: &Syntax, doc: &Rope, pos: usize, traverse_parents: bool) ->
6464 if end_byte == pos {
6565 return Some(start_char);
6666 }
67+
6768 // We return the end char if the cursor is either on the start char
6869 // or at some arbitrary position between start and end char.
69− return Some(end_char);
70+ if traverse_parents || start_byte == pos {
71+ return Some(end_char);
72+ }
7073 }
7174 }
7275 // this node itselt wasn't a pair but maybe its siblings are