jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
3.26k stars 111 forks source link

Broken zsh completion menu #122

Open anuvyklack opened 3 years ago

anuvyklack commented 3 years ago

General information

Basic examination

Problem description

On the latest commit (82f00eaefc95165f4524e77312db0d216a64a7ad) zsh completion menu broke inside tmux. Outside of tmux it works.

Reproduction steps

  1. setopt menu_complete
  2. enter tmux, print any command (cd for example) and press Tab

https://user-images.githubusercontent.com/13056013/132378718-6d132039-9cb8-44d2-9c8f-07c9c80c0f4d.mov

jeffreytse commented 3 years ago

Hi @anuvyklack

Thanks for your reporting. I will work on this issue as soon as possible.

Thanks and Regards

jeffreytse commented 3 years ago

Hi @anuvyklack

I can't reproduce this issue in my environment. Could you please try this version 1549325615a5da5ec570289dfa08687cece1c5f6, and feedback me the result?

Thanks and Regards

anuvyklack commented 3 years ago

1549325 works fine.

jeffreytse commented 3 years ago

@anuvyklack Could you please provide me the information by command echo $TERM

anuvyklack commented 3 years ago

tmux-256color

jeffreytse commented 3 years ago

@anuvyklack Could you please provide me a minimum .zshrc file which can reproduce this issue to have further check?

stefanboca commented 3 years ago

@jeffreytse I also had this issue. Reverting to 1549325 fixed it, and I managed to trace it down to the following changes:

-  zvm_update_cursor
+  if [[ -n $TMUX ]]; then
+    zvm_update_cursor
+    # Fix display is not updated in the terminal of InteliJ IDE
+    zle redisplay
+  fi

Reverting this change fixed the issue for me.

jeffreytse commented 3 years ago

@StefanBoca Thanks for your reaching out, I have confirmed the reason of this issue, but I am still exploring a good way to fix this issue, at the same time, keep the compatibility of the terminal in IntelliJ IDE. Could you provide me a minimum .zshrc file which can reproduce this issue to have a further check? Thanks and Regards

stefanboca commented 3 years ago

@jeffreytse My minimal .zshrc is

export ZSH="/home/user/.oh-my-zsh"
plugins=(zsh-vi-mode)
source $ZSH/oh-my-zsh.sh

If I load the plugin directly without loading Oh My Zsh, though, the problem disappears:

export ZSH="/home/user/.oh-my-zsh"
source $ZSH/custom/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh
jeffreytse commented 3 years ago

Hi @anuvyklack @StefanBoca

Thanks for your patience, now this issue has been addressed and fixed. Please update your plugin to the latest version and try again.

Thanks and Regards

anuvyklack commented 2 years ago

Hello, @jeffreytse.

I'm sorry, but for me still doesn't work. The same: all commits after c1480b4 are broken.

jeffreytse commented 2 years ago

Hi @anuvyklack

For the temporary solution, you can comment the line L3152 to disable redisplay as below:

 if [[ -n $TMUX ]]; then
    zvm_update_cursor
    # Fix display is not updated in the terminal of IntelliJ IDE.
    # We should update display only when the last widget isn't a
    # completion widget
    #
    # PLEASE COMMENT BELOW LINE
    #
    # [[ $LASTWIDGET =~ 'complet' ]] || zle redisplay
 fi

Thanks & Regards

weirongxu commented 2 years ago

Same problem here. My environment:

General information

Linux


MacOS

Reproduction steps

  1. ~/.zshrc
    autoload -U +X compinit && compinit
    zstyle ':completion:*' menu yes select
    source /Users/raidou/repos/zsh-vi-mode/zsh-vi-mode.zsh
  2. enter tmux
  3. input ls and press tab more than twice
michaelorr commented 2 years ago

I am also running into this issue. My environment is structurally the same as @weirongxu 's MacOS setup. Thank you so much for the workaround. Commenting out the zle redisplay fixes it for me. I'm leaving a comment just so you can gauge the impact and priority for this fix. Also, I'd hate to miss out on future updates because I'm no longer tracking upstream. Thanks so much for all your hard work on this plugin!

michaelorr commented 2 years ago

I have pushed up a PR which attempts to fix this issue: https://github.com/jeffreytse/zsh-vi-mode/pull/191

I cannot test in IntelliJ and would love if someone were able to verify the behavior there.

michaelorr commented 2 years ago

Barring any further bug reports here, I think this is fixed by https://github.com/jeffreytse/zsh-vi-mode/pull/191

michaelorr commented 2 years ago

Thank you everyone for the helpful diagnostic information above that led to the fix and thank you to @jeffreytse for maintaining this project and merging my commit!