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

Multi-word completion #41

Open
dozzes opened this issue May 4, 2013 · 2 comments
Open

Multi-word completion #41

dozzes opened this issue May 4, 2013 · 2 comments

Comments

@dozzes
Copy link

dozzes commented May 4, 2013

Is it possible to implement word by word completion with linenoise?
Lets assume we have commands:

command opt1 opt2
command opt3 opt4 opt5.
command opt7 opt8
command opt7 opt9

How can i organize completions to suggest for eaxample
"command" on typing any left substring of it then cycling through
next available options?

@lavignes
Copy link

I hacked this in my programming language's repl

The basic idea is that when tab is pressed, I found the location of the last space, and made a copy of the input buffer, I would then use the first character after that space as the string to complete and append that to that temporary copy and refresh that new line. I would populate the completion list with local variables and all the keywords of the language.

@w32zhong
Copy link

w32zhong commented Apr 18, 2016

I write some code in #115 to enable user to get cursor position from within the
completion code. Although I have not got the time to write an example of how to do the thing you want, but definitely you can implement that idea given the ability to get cursor position from within the completion callback.

cxw42 pushed a commit to cxw42/linenoise that referenced this issue Apr 26, 2021
Implementing forward\backward a word thorugh ctrl-<arrow>
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

3 participants