Skip to content

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

Closed
@jmuk

Description

@jmuk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions