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
Fix issue where partial accept duplicates last word #507
base: develop
Are you sure you want to change the base?
Conversation
When z-sy-h is enabled after autosuggestion widgets have already been bound, partial accepting the last part of a suggestion will result in that string being duplicated. I was able to reproduce using the following versions of the two plugins: - z-sy-h: dde84e1b25f059a298ce3189cddfd0778f998df3 - z-asug: ae315de and running the following commands interactively one after another: ``` zsh -df % source path/to/zsh-autosuggestions.zsh % source path/to/zsh-syntax-highlighting.zsh % bindkey -e % bindkey <alt-f> # shows 'bindkey -e-e' ``` The order of the `source` statements matters and the issue cannot be reproduced if the two source statements are executed together on one line. The problem is very similar to this one: #126 (comment) See GitHub issue #483
14af353
to
4ccfdb2
Compare
CI is being flaky since the async-by-default PR went in. It looks like |
Duplicate of # |
👍 This fixes the issue for me, when it occurs when I use a custom widget: $ zsh -df
$ source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
$ function key-cright() {
zle vi-forward-word -- $@
}
zle -N key-cright
bindkey $'\e[1;5C' key-cright
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS+=(key-cright) I'm not sure why |
Thanks, your fix works for me. Didn't even think I could resolve this issue so fast :D |
Thumbs up to @ericfreese. In my case, this commit fixes the duplicating problem with a custom The duplicating the last word upon partial acceptance of the last word issue has existed in various forms for several years now. It seems to happen to some people when using This
EDIT: It turns out I didn't need to create the custom widget above and could just use the built-in To sum up, the code above causes the duplicating the last word upon partial acceptance of the last word issue but the code below does not:
|
When z-sy-h is enabled after autosuggestion widgets have already been bound, partial accepting the last part of a suggestion will result in that string being duplicated.
I was able to reproduce using the following versions of the two plugins:
and running the following commands interactively one after another:
The order of the
source
statements matters and the issue cannot be reproduced if the two source statements are executed together on one line.The problem is very similar to this one:
#126 (comment)
See GitHub issue #483