Skip to content

GraphemeCursor::prev_boundary() crashes when the current position is at the beginning of the chunk #39

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

Closed
jmuk opened this issue Mar 16, 2018 · 1 comment

Comments

@jmuk
Copy link
Contributor

jmuk commented Mar 16, 2018

It'd be good if the following code works.

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

Currently it crashes during the first assertion, since prev_boundary expects at least there's one character from the chunk start to the cursor position.

jmuk added a commit to jmuk/unicode-segmentation that referenced this issue Mar 16, 2018
@jmuk
Copy link
Contributor Author

jmuk commented Mar 20, 2018

Seems missed to be losed, but #40 fixed this.

@jmuk jmuk closed this as completed Mar 20, 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