-
Notifications
You must be signed in to change notification settings - Fork 154
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
Split hinter tokens at Unicode word boundaries #650
Conversation
Partial completion behaves now like usual word movements by C-Left and C-Right.
Codecov Report
@@ Coverage Diff @@
## main #650 +/- ##
==========================================
+ Coverage 49.17% 49.21% +0.03%
==========================================
Files 42 43 +1
Lines 7921 7915 -6
==========================================
Hits 3895 3895
+ Misses 4026 4020 -6
|
i'm not familiar with Reedline but for people that might want to review this PR, could you add a bit more information? 😇
|
Sure, the main issue for me is the following:
This happens because currently the next history token is identified using only whitespace, while movements in
As additional context, the proposed changed is the mostly the same as |
A few issues related to this one:
|
thanks @stfacc 🙏 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this. Sounds like a good possible quality of life improvement.
Looks pretty good based on how we currently deal with words in src/core_editor/line_buffer.rs
.
I think it would be great if we could reduce the copy pasted code a bit here. I think we can make the is_whitespace_str
a crate level helper, and maybe you could figure out a good place to share the word advancing for the hinters.
reedline/src/core_editor/line_buffer.rs
Lines 751 to 754 in 973dbb5
/// Match any sequence of characters that are considered a word boundary | |
fn is_whitespace_str(s: &str) -> bool { | |
s.chars().all(char::is_whitespace) | |
} |
Hi, Since this is basically the same logic used for the LineBuffer, would it be useful to refactor even more and share the same code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactor! Looks good in testing. We can refine the word boundaries later. (e.g. ..
becomes two words, but that is something specific to e.g. Nushell where ..
are expected for paths or ranges)
Partial completion behaves now like usual word movements by C-Left and C-Right.
This is also useful to accept only parts of a suggested path.