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

History menu rendering broken by powerlevel10k kubecontext plugin.

Open RocusHalbasch opened this issue 1 year ago • 2 comments

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
  • Operating system: macOS Sonoma 14.4.1
  • Terminal emulator: iTerm2 3.5.0

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 avatar May 21 '24 20:05 RocusHalbasch

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.

RocusHalbasch avatar May 21 '24 21:05 RocusHalbasch

Also happens with one or both of the p10k gcloud and terraform plugins. I think I tried to solve it by messing with some zstyle settings relating to redrawing the prompt/zle but no dice. I've mainly noticed it when there's a gcloud or terraform command in my history that i'm trying to select. Normally, with the history menu open, tapping ↑ the first time to select the previous terraform command causes all history lines except for that to disappear - at this point hitting ⏎ causes the previous history item to populate the editor line - then tapping ↑ a second time will select the terraform command correctly (i.e. pressing ⏎ puts it back on the editor line)

Could this be a p10k problem?

nathanrawle avatar May 27 '25 21:05 nathanrawle