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

Use Unicode words for movement #5

Merged
merged 3 commits into from
Mar 8, 2021

Conversation

basile-henry
Copy link
Contributor

This PR also makes word movement skip multiple consecutive non-word characters (word boundaries) in a similar way to how bash/readline do it.

This also skips multiple consecutive non-word characters (word boundaries) as part of the movement in a similar way to how bash/readline do it.
}
}

/// Match any sequence of characters that are considered a word boundary
fn is_word_boundary(s: &str) -> bool {
!s.chars().any(char::is_alphanumeric)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This logic to identify a str as being a word boundary or not is copied from unicode-segmentation as it doesn't seem to be exposed as part of the public API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems okay. We might want to put an issue on unicode-segmentation and ask if they'd be willing to make it public (if you haven't already)

@sophiajt
Copy link
Contributor

sophiajt commented Mar 8, 2021

Looks good. thanks for simplifying the logic, too.

@sophiajt sophiajt merged commit b337d3a into nushell:main Mar 8, 2021
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

Successfully merging this pull request may close these issues.

2 participants