Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken zsh completion menu #122

Open
3 tasks done
anuvyklack opened this issue Sep 7, 2021 · 17 comments
Open
3 tasks done

Broken zsh completion menu #122

anuvyklack opened this issue Sep 7, 2021 · 17 comments
Assignees
Labels
bug Something isn't working verified This issue was already verified

Comments

@anuvyklack
Copy link

anuvyklack commented Sep 7, 2021

General information

  • Operating system: Pop!_OS 21.04
  • ZSH framework: none
  • ZSH version: 5.8-6
  • ZVM version: 82f00ea

Basic examination

  • I have read through the README page
  • I have the latest version of zsh-vi-mode
  • I have tested with another terminal program: kitty, gnome-terminal, tilix

Problem description

On the latest commit (82f00ea) 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
simplescreenrecorder-2021-09-07_19.20.12.mov
@jeffreytse jeffreytse self-assigned this Sep 8, 2021
@jeffreytse jeffreytse added the bug Something isn't working label Sep 8, 2021
@jeffreytse
Copy link
Owner

Hi @anuvyklack

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

Thanks and Regards

@jeffreytse
Copy link
Owner

jeffreytse commented Sep 8, 2021

Hi @anuvyklack

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

Thanks and Regards

@anuvyklack
Copy link
Author

1549325 works fine.

@jeffreytse
Copy link
Owner

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

@anuvyklack
Copy link
Author

tmux-256color

@jeffreytse
Copy link
Owner

jeffreytse commented Sep 9, 2021

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

@stefanboca
Copy link

@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
Copy link
Owner

@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
Copy link

@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 jeffreytse added the verified This issue was already verified label Sep 30, 2021
@jeffreytse
Copy link
Owner

jeffreytse commented Oct 4, 2021

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
Copy link
Author

Hello, @jeffreytse.

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

@jeffreytse
Copy link
Owner

jeffreytse commented Feb 21, 2022

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
Copy link
Contributor

weirongxu commented Feb 22, 2022

Same problem here.
My environment:

General information

Linux

  • Operating system: Linux 5.9.16-1-MANJARO x86_64
  • ZSH framework: none
  • ZSH version: 5.8 (x86_64-pc-linux-gnu)
  • ZVM version: 7878372
  • TMUX version: 3.2a
  • Terminal emulator: wezterm 20220101-133340-7edc5b5a

MacOS

  • Operating system: Darwin 20.6.0 x86_64
  • ZSH framework: none
  • ZSH version: 5.8.1 (x86_64-apple-darwin20.6.0)
  • ZVM version: 7878372
  • TMUX version: 3.2a
  • Terminal emulator: iTerm2 Build 3.4.15

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
Copy link
Contributor

michaelorr commented Apr 20, 2022

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 added a commit to michaelorr/zsh-vi-mode that referenced this issue Aug 23, 2022
IntelliJ terminal requires `zle redisplay` to be called but this breaks
completion menus in non IntelliJ terminals.

This uses an environment variable to detect whether we are in an
IntelliJ terminal and only calls `zle redisplay` for those environments.

Previously the code tried to guard against this bug by looking at `$LASTWIDGET`
but unfortunately we cannot reliably assume that the completion widget
has `complet` in the name (on my personal setup, I saw
`autosuggest-suggest` and `self-insert` as the `$LASTWIDGET` during
completions depending on context and other zsh plugins enabled).

See also: jeffreytse#122
@michaelorr
Copy link
Contributor

I have pushed up a PR which attempts to fix this issue:
#191

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

jeffreytse pushed a commit that referenced this issue Sep 22, 2022
IntelliJ terminal requires `zle redisplay` to be called but this breaks
completion menus in non IntelliJ terminals.

This uses an environment variable to detect whether we are in an
IntelliJ terminal and only calls `zle redisplay` for those environments.

Previously the code tried to guard against this bug by looking at `$LASTWIDGET`
but unfortunately we cannot reliably assume that the completion widget
has `complet` in the name (on my personal setup, I saw
`autosuggest-suggest` and `self-insert` as the `$LASTWIDGET` during
completions depending on context and other zsh plugins enabled).

See also: #122
@michaelorr
Copy link
Contributor

Barring any further bug reports here, I think this is fixed by #191

@michaelorr
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified This issue was already verified
Projects
None yet
Development

No branches or pull requests

5 participants