marlonrichert / zsh-autocomplete

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.
MIT License
5.27k stars 146 forks source link

`$((...))` in history causes history menu to get stuck #613

Open PoonKinWang opened 1 year ago

PoonKinWang commented 1 year ago

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace
typeset VENDOR=apple
typeset OSTYPE=darwin22.0
typeset ZSH_PATCHLEVEL=zsh-5.8.1-0-g1a490c7
typeset -a _autocomplete__funcfiletrace=(
  /Users/test/.oh-my-zsh/custom/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
  /Users/test/.oh-my-zsh/oh-my-zsh.sh:158
  /Users/test/.zshrc:82
  zsh:0
% git -C ~autocomplete log --oneline -n1
6d059a3 (HEAD -> main, origin/main, origin/HEAD) Fix bugs in insertion logic

Steps to reproduce

% cd $(mktemp -d)
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
Cloning into 'zsh-autocomplete'...
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 55 (delta 0), reused 38 (delta 0), pack-reused 0
Receiving objects: 100% (55/55), 1.64 MiB | 5.16 MiB/s, done.
% > .zshrc <<EOF
setopt interactivecomments transientrprompt
PS1='%# '
PS2=
RPS2='%^'
source $PWD/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
% env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d

Open a new terminal and then key in:

% x=10
% $((x/10))
zsh: command not found: 1

Then press up key and the cursor will blink between the first and last lines of the terminal. Then press ctrl+c and key in something and then the window of terminal will disappear. And the htop will display that zsh occupies a significant amount of CPU time.

Screenshot 2023-07-06 at 03 10 42
marlonrichert commented 1 year ago

Huh, I weird. I'm indeed able to reproduce this. Strangely enough, though, it doesn't always happen for me. Will have to investigate. Help welcome! 🙂

marlonrichert commented 1 year ago

@PoonKinWang I still haven't found a reliable way to reproduce this. Your example sometimes triggers the bug for me, but not always. It definitely never triggers for me in the test that you included.

Could you try to find a test case that always reliably reproduces the problem?

Cliffback commented 8 months ago

FWIW, I also get this issue quite frequently when browsing the history. Haven't found a way to reproduce it though.

Jacobluke- commented 5 months ago

I can reproduce it every time I activate a conda environment and browse the history