-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
disable if cursor is not at the end of the input line #343
Comments
But fish will show this suggestion at the end of the line? |
In the case described on the PR, the buffer would be "dock" after typing the "o", the suggestion would add "er" to the end of it. Pressing |
Do you have an example that produces a nonsense command? |
Assume that $PWD=/ Typing The problem is that the suggestion in such a case should be at the end of the word of the current cursor (which in the last due examples due to the "space" happens to be the empty word) and not at the end of the line. Of course, inserting suggestions in the middle of the line would be better, but this is very hard to implement. IMHO it is better to not produce them than to insert them in the wrong place. |
You are right: My patch is not correct: It should test whether the cursor is in the last word of the line, not in the last position. |
To prevent the suggestion from not starting with the buffer string. Example: `ls / /[cursor left][cursor left]b` Before the patch, suggests `ls /b /ls /bin/ /` After the patch, suggests `ls /b /bin/`. #343 (comment)
Thanks for those examples. I hadn't considered those cases. I've pushed another commit to #350 that moves the cursor to the end of the buffer in the completion pseudoterminal to ensure that completions are only generated at the end of the buffer. Let me know if that solves the issue for you. I've come across another similar issue and I'm not sure how to solve it. Typing |
It works perfectly now. I can confirm that pressing tab in a quoted string replaces the cursor, and I also did not find a zle setting to change this behaviour. Probably it is really best to ask on the ML. |
To prevent the suggestion from not starting with the buffer string. Example: `ls / /[cursor left][cursor left]b` Before the patch, suggests `ls /b /ls /bin/ /` After the patch, suggests `ls /b /bin/`. #343 (comment)
Ok I'm going to go ahead and close this ticket and open a new one for the issue described in my last comment. |
If the cursor is not at the end of the input line, the suggestions are written at the end of the line anyway.
This is confusing (and has strange side effects if the suggestion should be accepted).
It would of course be nice if the suggestion could be inserted at the cursor position.
If this is technically not possible or too hard to implement (as I suspect), I suggest to temporarily switch off the suggestions if the cursor is not at the end of the input line.
The text was updated successfully, but these errors were encountered: