Skip to content

Commit f4b488e

Browse files
committed
Remove unused helix_core::graphemes::is_grapheme_boundary
This function was never used and will be superseded by `RopeSliceExt::is_grapheme_boundary` (which accepts a byte index rather than a character index) once we transition to Ropey v2. In the meantime any callers should convert to byte index and use the `RopeSliceExt` extension rather than form new dependencies on this.
1 parent 7410fe3 commit f4b488e

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

helix-core/src/graphemes.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -242,34 +242,6 @@ pub fn ensure_grapheme_boundary_prev(slice: RopeSlice, char_idx: usize) -> usize
242242
}
243243
}
244244

245-
/// Returns whether the given char position is a grapheme boundary.
246-
#[must_use]
247-
pub fn is_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> bool {
248-
// Bounds check
249-
debug_assert!(char_idx <= slice.len_chars());
250-
251-
// We work with bytes for this, so convert.
252-
let byte_idx = slice.char_to_byte(char_idx);
253-
254-
// Get the chunk with our byte index in it.
255-
let (chunk, chunk_byte_idx, _, _) = slice.chunk_at_byte(byte_idx);
256-
257-
// Set up the grapheme cursor.
258-
let mut gc = GraphemeCursor::new(byte_idx, slice.len_bytes(), true);
259-
260-
// Determine if the given position is a grapheme cluster boundary.
261-
loop {
262-
match gc.is_boundary(chunk, chunk_byte_idx) {
263-
Ok(n) => return n,
264-
Err(GraphemeIncomplete::PreContext(n)) => {
265-
let (ctx_chunk, ctx_byte_start, _, _) = slice.chunk_at_byte(n - 1);
266-
gc.provide_context(ctx_chunk, ctx_byte_start);
267-
}
268-
Err(_) => unreachable!(),
269-
}
270-
}
271-
}
272-
273245
/// A highly compressed Cow<'a, str> that holds
274246
/// atmost u31::MAX bytes and is readonly
275247
pub struct GraphemeStr<'a> {

0 commit comments

Comments
 (0)