@@ -26,14 +26,16 @@ pub fn find(syntax: &Syntax, doc: &Rope, pos: usize) -> Option<usize> {
27 let start_byte = node.start_byte();
27 let start_byte = node.start_byte();
28 let end_byte = node.end_byte() - 1; // it's end exclusive
28 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);
30− if PAIRS.contains(&(doc.char(start_byte), doc.char(end_byte))) {
32+ if PAIRS.contains(&(doc.char(start_char), doc.char(end_char))) {
31 if start_byte == byte_pos {
33 if start_byte == byte_pos {
32− return Some(doc.byte_to_char(end_byte));
34+ return Some(end_char);
35 if end_byte == byte_pos {
37 if end_byte == byte_pos {
36− return Some(doc.byte_to_char(start_byte));
38+ return Some(start_char);