-
Notifications
You must be signed in to change notification settings - Fork 182
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
Support Partial Completion #513
Support Partial Completion #513
Conversation
You should be able to almost do it by yourself with rustyline >= 8 without hardcoding a nth binding in rustyline. Some(Cmd::CompleteHint) // TODO give access to hint |
@gwenn, do you suggest that I should extend |
This commit exposes the hint text to `ConditionalEventHandler` through `EventContext` so that custom event handler can implement partial completion. This feature is demonstrated in `custom_key_bindings`, fixing an open TODO.
67afb01
to
a3f20c0
Compare
I found a solution that fixes the open TODO with a minimal extension of the public API. Please, have another look. |
Perfect ! |
@gwenn, do you see any chance to merge this PR? |
Thanks for merging. 👍 😎 |
@gwenn - do you know when the next rustyline will get released? We'd like to be able to use this functionality in Nushell, when it's available |
@jonathandturner 8.1.0 is ready (but not published yet). Could you please confirm that you don't have any building issue on windows related to this change ? |
@gwenn - it's working for me in Windows |
@jonathandturner Version 8.1.0 released |
@gwenn great, thanks! |
@gwenn Do you, or anyone else listening, have the ability to test this in MacOS? I have a mac and cannot get it to work. I originally thought that MacOS was eating the commands ctrl+right and ctrl+left because when I use those keystrokes it changes to the next virutal desktop. So, I disabled those keystrokes in the MacOS preferences. But when I tried again, it still didn't work. I'm just wondering if anyone else has this experience and what they did to fix it? I also tried cmd+right/left and option+right/left to no avail. |
Yeah, I am really excited for this but can't seem to get it working on Mac OS. Option + left/right would be ideal (that is what Fish uses). |
@fdncred You can trace key events (or unsupported ANSI escape sequences) easily by using |
|
This is what I get using the command you specified. It launched and I did: It doesn't look like all my keystrokes were captured. [DEBUG rustyline::history] PathInfo("history.txt", SystemTime { tv_sec: 1621454572, tv_nsec: 410962579 }, 1) I also have this in my "\e[5C": forward-word |
@fdncred If you see no KeyEvent (even UnknownEscSeq), it means that nothing is read from stdin. |
I guess that's what's happening because there are no debug logs for control+right and control+left. So, is the theory that MacOS is eating those keystrokes or is it iTerm2? |
Any workarounds on MacOS yet? |
For MacOS and ctrl-left / ctrl-right, see https://superuser.com/a/357394:
|
This commit adds the ability to complete the current line with the word of the hint. When the cursor is at the end of the current line and CTRL + right arrow has been pressed, the next word of the hint will be added to the editor's line.
Closes #413