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

Porting the DoubleEndedIterator of segmenters #26

Open
cometkim opened this issue Apr 20, 2024 · 0 comments
Open

Porting the DoubleEndedIterator of segmenters #26

cometkim opened this issue Apr 20, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@cometkim
Copy link
Owner

The original Rust library implements the DoubleEndedIterator trait, which, unlike JavaScript's standard iterator, allows for reverse traversal (next_back())

The original goal was to be a lightweight alternative to Intl.Segmenter, so I intentionally removed it. But as I can see some issues in the ecosystem like flmnt/graphemer#10, it is one of the most common requirements in scenarios such as implementing an editor. Because, it would be crazy to re-traverse the entire text forward to find just the previous cursor. To avoid that, the user would have to implement their own cursor history, which is inefficient.

However, that significantly inflates the bundle size, which the generator cannot represent.

I will improved the class version implementation and expose it as a separate bundle entry (e.g unicode-segmenter/advanced/double-ended/grapheme)

@cometkim cometkim added this to the v1 milestone Apr 20, 2024
@cometkim cometkim added the enhancement New feature or request label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant