Handle erroneously ignored case in RopeGraphemes iterator.

This commit is contained in:
Nathan Vegdahl 2021-06-23 16:54:42 -07:00 committed by Blaž Hrastnik
parent 7f6265ecf3
commit 9cbf564d08

View file

@ -207,6 +207,10 @@ impl<'a> Iterator for RopeGraphemes<'a> {
self.cur_chunk_start += self.cur_chunk.len();
self.cur_chunk = self.chunks.next().unwrap_or("");
}
Err(GraphemeIncomplete::PreContext(idx)) => {
let (chunk, byte_idx, _, _) = self.text.chunk_at_byte(idx.saturating_sub(1));
self.cursor.provide_context(chunk, byte_idx);
}
_ => unreachable!(),
}
}