aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/graphemes.rs
diff options
context:
space:
mode:
authorNathan Vegdahl2021-06-23 23:54:42 +0000
committerBlaž Hrastnik2021-06-24 01:04:03 +0000
commit9cbf564d086a14b413d27f0514aa8f11b92ec880 (patch)
tree743572d51b6ab3c27131fcd2df8d66121af47391 /helix-core/src/graphemes.rs
parent7f6265ecf3380dea4179f49a8cc8e5734b4df174 (diff)
Handle erroneously ignored case in RopeGraphemes iterator.
Diffstat (limited to 'helix-core/src/graphemes.rs')
-rw-r--r--helix-core/src/graphemes.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-core/src/graphemes.rs b/helix-core/src/graphemes.rs
index af740f61..2e6a925f 100644
--- a/helix-core/src/graphemes.rs
+++ b/helix-core/src/graphemes.rs
@@ -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!(),
}
}