Skip to content

Under some conditions, when typing next cmd during previous cmd execution, prompt formatting gets mangled #39

Open
@AndydeCleyre

Description

@AndydeCleyre

Hello!

Sometimes I begin typing the next command while the previous one is running, and this works, even with this bug. But the prompt display gets temporarily mangled in this event.

This is hard for me to reliably reproduce with a clean setup, and so I'm sorry for such a messy report.

I think that to reproduce we need:

  • set the left-only prompt variable
  • set my ridiculous custom RPROMPT
  • be in a git repo folder (certain git status needed?)
  • be in a tmux session
  • load zcontinuum/fast-syntax-highlighting (?)

Here's my prompt-related code:

setopt promptsubst

() {
  emulate -L zsh

  local usual_distro='Arch Linux' usual_host='pop-os' usual_user='andy'
  local ptime='%D{%L:%M}'

  local agkozakpath p10kpath
  agkozakpath=~/Code/plugins/zsh/agkozak-zsh-prompt/agkozak-zsh-prompt.plugin.zsh
  p10kpath=~/Code/plugins/zsh/powerlevel10k/powerlevel10k.zsh-theme

  if [[ -r $agkozakpath ]] {
    if [[ $HOST != $usual_host || $USERNAME != $usual_user ]] {
      AGKOZAK_USER_HOST_DISPLAY=1
    } else {
      AGKOZAK_USER_HOST_DISPLAY=0
    }
    AGKOZAK_CUSTOM_SYMBOLS=('⇣⇡' '' '' '+' 'x' '!' '>' '?' 'S')
    AGKOZAK_LEFT_PROMPT_ONLY=1
    AGKOZAK_PROMPT_CHAR=('%F{white}%B->>%b%f' '#' ':')
    AGKOZAK_PROMPT_DIRTRIM=4
    AGKOZAK_PROMPT_DIRTRIM_STRING=…
    if [[ $TMUX ]] && [[ $TMUX != *tmate* ]] {
      AGKOZAK_CUSTOM_RPROMPT='${(j: :)${(f)"$(tmux lsw -F "#{?#{==:#{pane_tty},$TTY},%B%F{white#},%F{blue#}}#{?#{!=:#W,zsh},#W,%%}#{?#{!=:#{window_panes},1},+,}%f%b" 2>/dev/null)"}} %F{green}'$ptime'%f'
    } else {
      AGKOZAK_CUSTOM_RPROMPT='%F{green}'$ptime'%f'
    }

    . $agkozakpath

  } elif [[ -r $p10kpath ]] {

    # ...

  } else {
    # ...
  }
}

PROMPT2='%B%F{blue}->…%f%b '

When run within a tmux session, run sleep 1, and then keep typing while that finishes:

~/Code/zpy (develop S)
->> sleep 1                                                           % 12:37
xxxxxxxxxxxxxx%                                                               }~/Code/zpy} (develop S)${AGKOZAK_PROMPT_WHITESPACE}}${AGKOZAK_PROMPT_CHAR[1]:-%} xxxxxxxxxxxxxxxxxxxxx

image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions