-
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
WIP : When using vi-mode and zsh-syntax-highlighting, command is not highlighted after accepting suggestion #294
Conversation
I really don't want to have code here referencing another plugin. That's a slippery slope that will lead to this plugin getting bloated with all kinds of crazy stuff to support other plugins. Lets find another way to fix this if possible. Also, it seems like this bug could be described better as "When using vi-mode and zsh-syntax-highlighting, command is not highlighted after accepting suggestion", since the plugin is already largely compatible with z-sy-h. #6 is a very old issue, and is, in fact, already closed. |
I don't want to have code referencing another plugin as well, that's why I'm trying to setup something cleaner. I definitely don't consider this hack to be mergeable as-is, I'm adding a WIP tag in the title right now, to make it clear. I think we should be able to remove these references by replacing the manual cursor movement by a call to a widget such as I'm working on it, but right now I have a recursive function call causing a stack overflow. |
Here is a cleaner version, we're getting closer to something acceptable. I still need to figure out how the We also still need to care about the I tried to check whether the tests pass or not, but I can't get them to pass even on master, so… well, if someone can give it a try, I'd be really grateful ! |
Oh, by the way, I couldn't install ruby 2.3.1 because of this issue, that's why I bumped the ruby version up. Since the tests don't work at all for me, I can revert this change if it is the source of the problem. |
@toadjaune Is this still an issue? I'm not able to reproduce with following versions:
|
Yes it is, I was working on it when I ran into #324. I'll try and have a look in the weeks to come. |
I just tested, and the bug is still present for me, with the following versions :
I'd be glad to write a test showing the erroneous behaviour, but I'm not sure how to do this without loading zsh-syntax-highlighting, which would basically be an integration test (with all the version synchronization issues that arise from these). In the meantime, I've merged |
e8bed2f
to
5541533
Compare
I've finally reproduced this! I have |
It seems to be caused by updating the Here is an alternative fix that also solves the issue: diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh
index 1c3eab5..d94fa42 100644
--- a/zsh-autosuggestions.zsh
+++ b/zsh-autosuggestions.zsh
@@ -412,11 +412,13 @@ _zsh_autosuggest_accept() {
# Remove the suggestion
unset POSTDISPLAY
+ _zsh_autosuggest_invoke_original_widget $@
+
# Move the cursor to the end of the buffer
CURSOR=${#BUFFER}
+ else
+ _zsh_autosuggest_invoke_original_widget $@
fi
-
- _zsh_autosuggest_invoke_original_widget $@
}
# Accept the entire suggestion and execute it
|
This should have been closed a long time ago since #488 fixed it :) |
I accidentally closed #260 by rebasing on the top of develop, so I'm reopening it here.
I'll be trying to fix it properly soon.