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

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

Open PoonKinWang opened this issue 11 months ago • 4 comments

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
  • Operating system: macOS Monterey 12.6.5
  • Terminal emulator: default terminal

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

PoonKinWang avatar Jul 05 '23 19:07 PoonKinWang

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 avatar Jul 12 '23 20:07 marlonrichert

@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?

marlonrichert avatar Aug 22 '23 20:08 marlonrichert

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

Cliffback avatar Jan 30 '24 08:01 Cliffback

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

Jacobluke- avatar Apr 25 '24 02:04 Jacobluke-