Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes GraphemeCursor::prev_boundary returns PrevChunk but can't process anymore #38

Closed
jmuk opened this issue Mar 16, 2018 · 0 comments

Comments

@jmuk
Copy link
Contributor

jmuk commented Mar 16, 2018

I got a sample code:

let s = "abcd";
let mut cursor = GraphemeCursor::new(3, s.len(), false);
assert_eq!(cursor.prev_boundary(&s[2..], 2), Err(GraphemeIncomplete::PrevChunk));
assert_eq!(cursor.prev_boundary(&s[..2], 0), Ok(Some(2)));

On the second assertion, it instead returns Err(GraphemeIncomplete::InvalidOffset). If it starts from position 4, as is written in the doc comment, it works. However it does not work when the cursor position starts from 3.

jmuk added a commit to jmuk/unicode-segmentation that referenced this issue Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant