@@ -26,14 +26,16 @@ pub fn find(syntax: &Syntax, doc: &Rope, pos: usize) -> Option<usize> {
2626
2727 let start_byte = node.start_byte();
2828 let end_byte = node.end_byte() - 1; // it's end exclusive
29+ let start_char = doc.byte_to_char(start_byte);
30+ let end_char = doc.byte_to_char(end_byte);
2931
30− if PAIRS.contains(&(doc.char(start_byte), doc.char(end_byte))) {
32+ if PAIRS.contains(&(doc.char(start_char), doc.char(end_char))) {
3133 if start_byte == byte_pos {
32− return Some(doc.byte_to_char(end_byte));
34+ return Some(end_char);
3335 }
3436
3537 if end_byte == byte_pos {
36− return Some(doc.byte_to_char(start_byte));
38+ return Some(start_char);
3739 }
3840 }
3941