-
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
Extra space being output after tab completion #244
Comments
I can confirm this and this is weird for me, too. |
This looks like the offending commit. 2580b04 That change looks like it will always place a space after every completion so long as the cursor is at the end of the line which is not good at all if the string being completed is something like a path, which adds each token as the user hits tab. Throwing a space in there completely messed it up. |
Maybe make this optional, because for my purposes, this is actually kind of nice. |
@gnodet Any update on this? It continues to be an issue for CommandBox CLI. |
@gnodet Any feedback on this? The space isn't always desired since some tab completions are partial matches. Here is an example from CommandBox CLI. JLine is used to complete parameter names for CLI commands (we allow both positional and named parameters). So a user can type something like this:
So if they type only
Basically, just because there is only one match in the completor, it is not safe to assume that the use wants a space. It could simply be that the completor is giving a partial match and the user needs to finish typing the rest of the token. Previously before this regression, I would decide myself if a completion option needed to have a space after it. |
I suppose the behavior could be made configurable... |
That would be nice, though I'd recommend doing it at the completor level. The built-in completers may expect one thing, but in this case I have a custom completer that comes with different expectations. If memory serves, I believe you allow more than one completer and they may have their own desired default. |
Here's another quick of example of where this behavior is unsavory that I just happened to run across again. My custom completer handles file system completion too, but one directory deep at a time. Consider the following directories
It used to be in previous versions of JLine, the user could hit
and get
But now there's an extra space after
Since |
Yeah, fwiw, the problem is also fixed in 3.0 because the completers return a Candidate object which includes a boolean to tell if the completion is complete (and the reader should append a separator) or not. |
FWIW, I just noticed today that it appears this was fixed a while back but as part of a different ticket: I noticed while looking at the code to try and put in a fix of my own until I made it to JLine3. For anyone reading this after the fact, this is how I got the old behavior back.
I'm closing this ticket since it turns out there is a fix for it. |
After updating to JLine 2.14.1, I am getting an extra space output that never used to be there in JLine 2.12 when hitting tab and getting completion results. This is pretty problematic as the completion item might be a folder name and then I can't just keep typing the next folder or file name because there is a space I need to delete first. I haven't dug into the code to see what change has caused this but I did search the other issues quickly and didn't see this reported anywhere else.
The text was updated successfully, but these errors were encountered: