romkatv / powerlevel10k

A Zsh theme
MIT License
45.26k stars 2.15k forks source link

Prompt flickers during startup if using instant prompt #2249

Closed pavelgordon closed 1 year ago

pavelgordon commented 1 year ago

Hello! I use zsh+powerlevel10k for a long time, and I love it! Currently in optimization stage and pretty happy with startup time but can't figure how to solve the flickering of prompt on startup, see details and video below: With Instant Prompt:

https://user-images.githubusercontent.com/2462444/230038787-c0639e94-9e07-4e72-a0bf-6f68bb3a878a.mov

Without Instant Prompt:

https://user-images.githubusercontent.com/2462444/230038486-40445e8a-d1e2-4afe-975d-4791314dbd0e.mov

Setup: zsh+powerlevel10k, clean installation. I kept the setup as basic as possible OS: macOS Ventura 13.3 Terminal: iTerm2 Build 3.4.19 Zsh: zsh 5.9 (x86_64-apple-darwin22.1.0)

~ ❯ ~/zsh-bench/zsh-bench

==> benchmarking login shell of user pavelg ...
creates_tty=0
has_compsys=1
has_syntax_highlighting=0
has_autosuggestions=0
has_git_prompt=1
first_prompt_lag_ms=32.455
first_command_lag_ms=246.249
command_lag_ms=14.320
input_lag_ms=3.549
exit_time_ms=156.824

.zshrc https://gist.github.com/pavelgordon/f10c8c74a9a8c7bac65c8ff02c00a5a6

.pk10k.zsh https://gist.github.com/pavelgordon/20f62ad0d665c0648a0afea6f91c4f21

Any tips on how I could fix the flickering? Instant prompt is probably just a symptom and not a root cause, but I wonder why does the prompt renders second time... Thanks in advance!

romkatv commented 1 year ago

It probably depends on the terminal. Also keep in mind that zmodload zsh/zprof makes everything slower.

Subjective commented 1 year ago

Not sure if this'll be seen, but for anyone using Kitty, you can try playing around with the input_delay setting. I was able to completely fix the flickering issue by increasing it from the default value of 3 to 4. Crazy how such a small change made all the difference.