We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
is_grapheme_boundary
1 parent ae8ac16 commit af51af2Copy full SHA for af51af2
src/rope/utils.rs
@@ -158,6 +158,10 @@ pub(super) fn is_grapheme_boundary(
158
159
debug_assert!(byte_offset <= byte_len);
160
161
+ if byte_len == 0 {
162
+ return true;
163
+ }
164
+
165
let mut cursor = GraphemeCursor::new(0, byte_len, true);
166
cursor.set_cursor(byte_offset);
167
tests/graphemes.rs
@@ -138,3 +138,9 @@ fn graphemes_is_boundary_out_of_bounds() {
138
let r = Rope::from("🇷🇸🇮🇴");
139
assert!(r.is_grapheme_boundary(17));
140
}
141
142
+#[cfg(feature = "graphemes")]
143
+#[test]
144
+fn graphemes_is_boundary_empty_rope() {
145
+ assert!(Rope::new().is_grapheme_boundary(0));
146
+}
0 commit comments