marlonrichert / zsh-autocomplete

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

History menu rendering broken by powerlevel10k kubecontext plugin. #719

Open RocusHalbasch opened 1 month ago

RocusHalbasch commented 1 month ago

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace
typeset VENDOR=apple
typeset OSTYPE=darwin23.0
typeset ZSH_PATCHLEVEL=zsh-5.9-0-g73d3173
typeset -a _autocomplete__funcfiletrace=(
  /Users/rhalbasch/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-marlonrichert-SLASH-zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
  /Users/rhalbasch/.zsh_plugins.zsh:9
  /opt/homebrew/Cellar/antidote/1.9.6/share/antidote/functions/antidote-load:24
  /opt/homebrew/Cellar/antidote/1.9.6/share/antidote/functions/antidote-main:38
  /opt/homebrew/Cellar/antidote/1.9.6/share/antidote/functions/antidote:15
  /Users/rhalbasch/.zshrc:28
  zsh:0
)
% git -C ~autocomplete log --oneline -n1
1968100 (grafted, HEAD -> main, origin/main, origin/HEAD) Fix bugs in `recent-paths` widget

Steps to reproduce

% cd $(mktemp -d)
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
Cloning into 'zsh-autocomplete'...
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (51/51), done.
remote: Total 53 (delta 0), reused 28 (delta 0), pack-reused 0
Receiving objects: 100% (53/53), 1.64 MiB | 4.22 MiB/s, done.
% git clone --depth=1 -- https://github.com/romkatv/powerlevel10k.git
Cloning into 'powerlevel10k'...
remote: Enumerating objects: 92, done.
remote: Counting objects: 100% (92/92), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 92 (delta 18), reused 75 (delta 13), pack-reused 0
Receiving objects: 100% (92/92), 349.61 KiB | 1.92 MiB/s, done.
Resolving deltas: 100% (18/18), done.
% > .zshrc <<EOF
setopt interactivecomments transientrprompt
PS1='%# '
PS2=
RPS2='%^'
source $PWD/zsh-autocomplete/zsh-autocomplete.plugin.zsh
source $PWD/powerlevel10k/powerlevel10k.zsh-theme
EOF
% env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d
# At this point the config for powerlevel10k will come up. Complete the config and it will drop you to a prompt.
# I did the following answers y y y y 3 1 1 3 2 5 2 3 4 4 1 2 2 y 1 y
% ls
powerlevel10k       zsh-autocomplete
% ls
powerlevel10k       zsh-autocomplete
% kubectl version
Client Version: v1.29.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.25.16-eks-adc7111
WARNING: version difference between client (1.29) and server (1.25) exceeds the supported minor version skew of +/-1
% ls
powerlevel10k       zsh-autocomplete
# At this point press the up arrow to bring up the history menu and press up one more time to select 
# kubectl version and you will notice the menu mostly disappears. This is due to the fact that selecting the kubectl 
# command changes the input to the prompt which in turn triggers the kubecontext plugin in powerlevel10k which 
# then redraws the prompt to include the kube context.
Contents of ~autocomplete-log/2024-05-21.log (click to expand)

RocusHalbasch commented 1 month ago

This also occurs with the aws plugin. It can be worked around by disabling those plugins but I would prefer to be able to use them and autocomplete at the same time.