zsh-autosuggestions icon indicating copy to clipboard operation
zsh-autosuggestions copied to clipboard

Completion Strategy Triggers ^J bound widgets

Open quicknir opened this issue 10 months ago • 1 comments

Describe the bug

If anything is bound to ^J, and the completion strategy is active for zsh-autosuggestions, then if you quickly type an auto completion, backspace, type more, backspace, etc, you'll see that whatever ^J is bound to gets called quite often.

To Reproduce

Steps to reproduce the behavior:

Have this in your .zshrc

autoload -Uz compinit
compinit
function blub() { echo hello >> ~/log.txt }
builtin zle -N blub
bindkey -v '^J' blub

. "${ZDOTDIR:h}/zsh-autosuggestions/zsh-autosuggestions.zsh"
export ZSH_AUTOSUGGEST_STRATEGY=(completion)

touch ~/log.txt. Now, if you start typing say cd Do and zsh-autosuggestions suggests "wnloads", I type wn, then backspace, then w, then backspace, etc. Just keep typing some of the suggestion and backspacing without accepting it. After doing this for a bit, you'll see that ~/log.txt has lots of lines of hello in it.

Desktop

  • Ubuntu 22.04.5 LTS (running on WSL)
  • zsh 5.9
  • I tried both 0.7.0 and 0.7.1 and saw the same behavior on both.

quicknir avatar Nov 29 '24 21:11 quicknir