jeffreytse / zsh-vi-mode

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

Fix for completion display bug with tmux/IntelliJ #191

Closed michaelorr closed 1 year ago

michaelorr commented 1 year ago

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. See also: https://youtrack.jetbrains.com/issue/IDEA-191464/Add-environment-variable-to-terminal-detect-if-running-in-IntelliJ-IDES

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: https://github.com/jeffreytse/zsh-vi-mode/issues/122

michaelorr commented 1 year ago

I do not use IntelliJ and I would love if someone could validate behavior inside the IntelliJ terminal. I have seen reliably that IntelliJ should be setting this environment variable and I can validate that setting this environment variable reintroduces the bug for non-IntelliJ terminals and removing the environment variable fixes the bug for non-IntelliJ terminals

michaelorr commented 1 year ago

Hey @jeffreytse , no real urgency but I'm just curious what would be necessary to help move this forward?

jeffreytse commented 1 year ago

Hi @michaelorr

Thanks for your contribution to this project, I will try to do a quick review as soon as possible. : )

Thanks & Regards