zdharma-continuum / fast-syntax-highlighting

Feature-rich syntax highlighting for ZSH

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug]: Prompt formatting sometimes mangled when typing before a running command finishes

AndydeCleyre opened this issue · comments

Describe the bug

I've begun a discussion of the issue at agkozak/agkozak-zsh-prompt#39, the prompt with which I see this issue. More details are there, but notably @agkozak wrote:

I only seem to have this problem if I use zdharma-continuum/fast-syntax-highlighting (it doesn't happen with zsh-users/zsh-syntax-highlighting). In fact, I run into it reliably with a mere

source /path/to/agkozak-zsh-prompt.plugin.zsh
source /path/to/fast-syntax-highlighting.plugin.zsh

in my .zshrc, and sleep 1, followed by fast typing, at the command line -- as you pointed out.

Reversing the order in which I load the two plugins seems to help slightly; if any garbling occurs, it is corrected when I switch to vi command mode. Interesting.

I have found that I don't see this problem if I revert 08a4ce9.

Steps to reproduce

% mkdir fsh-demo
% cd fsh-demo
% $EDITOR .zshrc

.zshrc:

if [[ ! -f ${0:h}/.zcomet/bin/zcomet.zsh ]]; then
  command git clone https://github.com/agkozak/zcomet.git ${0:h}/.zcomet/bin
fi

source ${0:h}/.zcomet/bin/zcomet.zsh

. ${0:h}/.zcomet/bin/zcomet.zsh
() {
  local plugin
  for plugin (
    agkozak/agkozak-zsh-prompt
    zdharma-continuum/fast-syntax-highlighting
  ) zcomet load $plugin
}
zcomet compinit

AGKOZAK_BLANK_LINES=1
AGKOZAK_LEFT_PROMPT_ONLY=1
AGKOZAK_PROMPT_DIRTRIM=4
AGKOZAK_PROMPT_DIRTRIM_STRING=…
WORDCHARS=${WORDCHARS//[\/]}
% exec zsh -f
% . ./.zshrc
% sleep 2

While sleep is running, hold down a letter key until after the prompt returns.

You may need to try a few times. You may need to be in tmux session.

Expected behavior

When the prompt appears it should be formatted as usual.

Screenshots and recordings

asciicast

Operating System & Version

linux-gnu | ubuntu | x86_64 | x86_64 | x86_64 x86_64

Zsh version

zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

Terminal emulator

wezterm tmux-256color

If using WSL on Windows, which version of WSL

No response

Additional context

No response

I'll note that I also see this issue locally.