From 9cbf564d086a14b413d27f0514aa8f11b92ec880 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Wed, 23 Jun 2021 16:54:42 -0700 Subject: [PATCH] Handle erroneously ignored case in RopeGraphemes iterator. --- helix-core/src/graphemes.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helix-core/src/graphemes.rs b/helix-core/src/graphemes.rs index af740f61e..2e6a925f2 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!(), } }