The grapheme boundaries of "馃嚪馃嚫馃嚠馃嚧" should be 8 and 16, but by feeding GraphemeCursor the individual RIS codepoints I get 8 and 12. Am I using the API incorrectly or is this a bug?
use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete};
fn main() {
let s = "馃嚪馃嚫馃嚠馃嚧";
let mut cursor = GraphemeCursor::new(0, s.len(), true);
// 馃嚪馃嚫
match cursor.next_boundary("馃嚪", 0) {
Err(GraphemeIncomplete::NextChunk) => {}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚫", 4) {
Err(GraphemeIncomplete::PreContext(4)) => {
cursor.provide_context("馃嚪", 0);
}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚫", 4) {
Err(GraphemeIncomplete::NextChunk) => {}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚠", 8) {
Err(GraphemeIncomplete::PreContext(8)) => {
cursor.provide_context("馃嚫", 4);
}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚠", 8) {
Err(GraphemeIncomplete::PreContext(4)) => {
cursor.provide_context("馃嚪", 0);
}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚠", 8) {
Ok(Some(8)) => {}
_ => unreachable!(),
}
// 馃嚠馃嚧
match cursor.next_boundary("馃嚠", 8) {
Err(GraphemeIncomplete::NextChunk) => {}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚧", 12) {
Err(GraphemeIncomplete::PreContext(12)) => {
cursor.provide_context("馃嚠", 8);
}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚧", 12) {
Err(GraphemeIncomplete::PreContext(8)) => {
cursor.provide_context("馃嚫", 4);
}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚧", 12) {
Err(GraphemeIncomplete::PreContext(4)) => {
cursor.provide_context("馃嚪", 0);
}
_ => unreachable!(),
}
match cursor.next_boundary("馃嚧", 12) {
Ok(Some(16)) => {}
Ok(Some(12)) => panic!("this should be 16"),
_ => unreachable!(),
}
}
The grapheme boundaries of "馃嚪馃嚫馃嚠馃嚧" should be 8 and 16, but by feeding
GraphemeCursorthe individual RIS codepoints I get 8 and 12. Am I using the API incorrectly or is this a bug?