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

Word navigation #83

Open
dhardy opened this issue Aug 12, 2020 · 1 comment
Open

Word navigation #83

dhardy opened this issue Aug 12, 2020 · 1 comment

Comments

@dhardy
Copy link

dhardy commented Aug 12, 2020

Text-editors typically make Ctrl+Left jump to the previous start-of-word and Ctrl+Right jump to the next end-of-word (or sometimes start-of-next-word). To implement this, we can use split_word_bound_indices to find word boundaries, however, it returns all word boundaries (start and end).

At first attempt to improve on this, one can skip indices where the next (or previous) char is whitespace. This is an improvement, but not perfect since e.g. in a::b every position is considered a word boundary while the user would expect to skip over :: as a whole (and possibly on until the next word's start/end).

This may not be a problem you wish to solve, in which case, fair enough. But, any idea how it might be done?

BTW if you wish to test this in action, see KAS. The layout example has a passable editor (for small documents). The word-navigation code in question is around here (disregard the TODO comment if you see this before the next commit lands).

@Manishearth
Copy link
Member

We'd accept a WordCursor API similar to GraphemeCursor (#23)

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

2 participants