zsh-autocomplete: Autosuggestion stops functioning with zsh 5.9 after a few directory changes
doesn’t seem to happen with zsh 5.8
Environment
apple darwin21.3.0 /bin/zsh /opt/local/bin/zsh zsh-5.9-0-g73d3173
/Users/ray.janoka/.zsh-snap/functions/.znap.source:26
/Users/ray.janoka/.zsh-snap/functions/znap:42
.zsh.d/zsnap.zsh:2
/Users/ray.janoka/.zshrc:134
5b0073d (grafted, HEAD -> main, origin/main, origin/HEAD) Check that `$ZSH_COMPDUMP` file can be read
- Operating system: macOS
- Terminal emulator: iTerm
Steps to reproduce
cd $(mktemp -d)
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
> .zshrc <<EOF
PS1='%# ' PS2= RPS2='%^'; setopt transientrprompt interactivecomments
source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} /opt/local/bin/zsh -d
Cloning into 'zsh-autocomplete'...
remote: Enumerating objects: 59, done.
remote: Counting objects: 100% (59/59), done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 59 (delta 0), reused 27 (delta 0), pack-reused 0
Receiving objects: 100% (59/59), 1.64 MiB | 5.47 MiB/s, done.
% cd zsh-autocomplete
% cd ..
% cd zsh-autocomplete
% cd ..
% cd zsh-autocomplete
% cd ..
% cd zsh-autocomplete
% cd ..
% cd zsh-autocomplete
% cd ..
% cd zsh-autocomplete
% cd ..
% cd zsh-autocomplete
% cd ..
% cd zsh-autocomplete
% cd ..
% cd zsh-autocomplete
% cd
there will be no suggestion for the final cd
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 56 (25 by maintainers)
Commits related to this issue
- Work around integer conversion issue Resolves #441 — committed to Mordna/zsh-autocomplete by Mordna 2 years ago
- Work around integer conversion issue Resolves #441 — committed to Mordna/zsh-autocomplete by Mordna 2 years ago
- Work around integer conversion issue Resolves #441 — committed to Mordna/zsh-autocomplete by Mordna 2 years ago
- Work around integer conversion issue Resolves #441 — committed to marlonrichert/zsh-autocomplete by Mordna 2 years ago
Results in
0
Does not work
Works!
That seems to be the case.
Not a VM but, a docker file Create a file called
Dockerfile
in a empty directory.And then in the same folder run
sudo docker build -t nodebb .
sudo docker run -it --entrypoint /bin/zsh nodebb
And then zsh comfiguration screen will pop up, complete it. Next do:And do what https://github.com/marlonrichert/zsh-autocomplete/issues/441#issuecomment-1160331716 says to reproduce the scenario. I personally can reproduce it just by typing
cd zsh-autocomlete
individually, and delete the command by holding backspace.What happens if you try to replicate this on the command line? For example:
Does it print
9
or0
?I wonder if
[#10]
in Zsh 5.9 causes the return value ofmax
to be converted to int before being multiplied by 100?What if you instead try
Does that work correctly?
I’d prefer something like this:
Can you test if that works?
As an aside, I’m planning to rewrite that part of the code. It’s a rather naive implementation. I have not yet been able to find time for it, though.
I’d still suggest @marlonrichert to take a look at it… the line should probably be something like:
zselect -t "$(( [#10] 100 * min_delay ))
, since min_delay is configurable.I think I might have found the problem.
scripts/.autocomplete.async line 214
I changed it from
zselect -t "$(( [#10] 100 * max( 0, min_delay - SECONDS ) ))"
to
zselect -t "$(( [#10] 100 * 0.05 ))
and havent had an issue since.
I don’t know what other issue this may cause, but as @Mordna pointed out about zmathfunc, I focused on all min/max calls and just tried changing stuff randomly 😄)
Output after plugin stopped working, running
functions -T .autocomplete.async.complete .autocomplete.zle-flags
andcd
:Click to expand
Click to expand
@marlonrichert
Hoping this helps (didn’t really know what you menat with activate autocompletion once, but i just typed
cd
once after runningfunctions -T ...
)Click to expand
Update: My very uneducated guess was wrong. I tried to reproduce it on my convertible Laptop (running Linux Mint with Kernel v5.4, i3-6100U CPU and 4GB of RAM) and was unable to reproduce it with and without (which isn’t really surprising since it’s running zsh v5.8) the docker file.
So it seems to only be an issue with newer Kernels or arch-based Kernels (and macOS from what other commenters said), so far i’ve only noticed the issue on anything arch-based (tried it on Manjaro, Arch and Arcolinux so far). It’s also independent from the Terminal Emulator (same issue with Konsole, xfce4-terminal and Terminator).
I can try and provide a setup for a VM to reproduce the issue in a bit.
Same here. After pressing the Enter key exactly 27 times, every time, the completions disappear. The problem occurs only on zsh 5.9, downgrading to 5.8.1 fixes it.
Can verify this breaks the completions for me as well. manjaro + zsh 5.9