Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with cursor position when suspending process to background #251

Closed
dflaxx opened this issue Oct 8, 2019 · 15 comments
Closed

Problem with cursor position when suspending process to background #251

dflaxx opened this issue Oct 8, 2019 · 15 comments

Comments

@dflaxx
Copy link

dflaxx commented Oct 8, 2019

Hi,

I'm using oh-my-zsh (clean install, default config) with p10k as a theme. I'm experience the following problem: When I open a foreground process from the shell, say vim or htop, and then suspend that job using Ctrl+Z, the cursor is in the wrong position, shifted to the left, overlapping the path or the ">" symbol. Only terminating the background (fg, then Ctrl+C) process seems to reset everything to normal. Necessary fonts are installed and unset ZLE_RPROMPT_INDENT as suggested by the FAQ does not seem to solve the issue.

Steps to reproduce:

  1. Open a terminal.
  2. Call a foreground shell program like vim or htop.
  3. Suspend the program using Ctrl+Z.

I'm using Linux 4.19.69-1-MANJARO x86_64.

Here is my .zshrc:

export ZSH="/home/dflachs/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(git)
source $ZSH/oh-my-zsh.sh
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh

Any hints on how to solve that problem are appreciated!

@romkatv
Copy link
Owner

romkatv commented Oct 8, 2019

I cannot reproduce this. Will need some extra info to figure out what's going on.

the cursor is in the wrong position, shifted to the left, overlapping the path or the ">" symbol.

Is this just on the first prompt after you press Ctrl-Z, or does it persist?

Does it get resolved if you type bg after Ctrl-Z?

Does it get resolved if you type fg after Ctrl-Z and quit the application?

Do you experience the same issue if you type sleep 10&?

Please post the output of the following command:

() {
  setopt
  emulate -L zsh
  uname -a
  typeset -m 'POWERLEVEL9K_*|ZSH_VERSION|ZSH_PATCHLEVEL|ZLE_RPROMPT_INDENT|TERM'
}

Can you reproduce this from a shell started with the following command?

(
  emulate -L zsh
  setopt no_unset err_return
  local tmp && tmp="$(mktemp -d ${TMPDIR:-/tmp}/p10k.XXXXXXXXXX)"
  {
    cd $tmp
    git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git oh-my-zsh/custom/themes/powerlevel10k
    >$tmp/.zshrc echo "
      ZSH=${(q)tmp}/oh-my-zsh
      plugins=()
      ZSH_THEME=powerlevel10k/powerlevel10k
      source \$ZSH/custom/themes/powerlevel10k/config/p10k-lean.zsh
      source \$ZSH/oh-my-zsh.sh"
    ZDOTDIR=$tmp zsh
  } always {
    cd || true
    rm -rf $tmp
  }
)

@dflaxx
Copy link
Author

dflaxx commented Oct 8, 2019

Thanks for your quick reply! I'll answer your questions in the following one by one.

Is this just on the first prompt after you press Ctrl-Z, or does it persist?

It persists. However, after the next successfully run command (with some other process in the background), the cursor is on the ">" symbol instead of the path. I'll attach a screenshot to make this clearer:
zsh1
zsh2
As you can see, there seems to be an issue with the indentation to the right.
zsh3
zsh4
zsh5

Does it get resolved if you type fg after Ctrl-Z and quit the application?

Yes.

Do you experience the same issue if you type sleep 10&?

Yes.

Please post the output of the following command:

alwaystoend
autocd
autopushd
completeinword
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
incappendhistory
interactive
interactivecomments
longlistjobs
monitor
promptsubst
pushdignoredups
pushdminus
sharehistory
shinstdin
zle
Linux arboria 4.19.69-1-MANJARO #1 SMP PREEMPT Thu Aug 29 08:51:46 UTC 2019 x86_64 GNU/Linux
POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_FOREGROUND=76
POWERLEVEL9K_NORDVPN_FOREGROUND=39
POWERLEVEL9K_PROMPT_CHAR_OK_VIVIS_CONTENT_EXPANSION=$'\M-b\M-\C-E\M-$'
POWERLEVEL9K_SHORTEN_DELIMITER=''
POWERLEVEL9K_RVM_SHOW_PREFIX=false
POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
POWERLEVEL9K_OS_ICON_FOREGROUND=''
POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=178
POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=39
POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND=70
POWERLEVEL9K_LOAD_NORMAL_FOREGROUND=66
POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=70
POWERLEVEL9K_PROXY_FOREGROUND=68
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( dir vcs prompt_char )
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_CONTENT_EXPANSION=$'\M-b\M-\C-]\M-/'
POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
POWERLEVEL9K_VCS_CLEAN_FOREGROUND=76
POWERLEVEL9K_PUBLIC_IP_FOREGROUND=94
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY=true
POWERLEVEL9K_BATTERY_VERBOSE=false
POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
POWERLEVEL9K_RIGHT_LEFT_WHITESPACE=''
POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIINS_FOREGROUND=196
POWERLEVEL9K_RVM_FOREGROUND=168
POWERLEVEL9K_RVM_SHOW_GEMSET=false
POWERLEVEL9K_KUBECONTEXT_DEFAULT_CONTENT_EXPANSION='${P9K_KUBECONTEXT_CLOUD_CLUSTER:-${P9K_KUBECONTEXT_NAME}}${${:-/$P9K_KUBECONTEXT_NAMESPACE}:#/default}'
POWERLEVEL9K_KUBECONTEXT_CLASSES=( '*' DEFAULT )
ZSH_VERSION=5.7.1
POWERLEVEL9K_RUST_VERSION_FOREGROUND=37
POWERLEVEL9K_CONTEXT_DEFAULT_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=76
POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
POWERLEVEL9K_NODEENV_LEFT_DELIMITER=''
POWERLEVEL9K_NORDVPN_CONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_TIME_FOREGROUND=66
POWERLEVEL9K_KUBECONTEXT_DEFAULT_FOREGROUND=134
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101
POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=70
POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false
ZSH_PATCHLEVEL=zsh-5.7.1-0-g8b89d0d
POWERLEVEL9K_VCS_BRANCH_ICON=''
POWERLEVEL9K_RAM_FOREGROUND=66
POWERLEVEL9K_VPN_IP_FOREGROUND=81
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=' '
POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=160
POWERLEVEL9K_STATUS_OK=false
POWERLEVEL9K_TERRAFORM_FOREGROUND=38
POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=70
POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION=$'\M-b\M-\C-F\M-5'
POWERLEVEL9K_NORDVPN_DISCONNECTING_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY=true
POWERLEVEL9K_CONTEXT_SUDO_CONTENT_EXPANSION=''
POWERLEVEL9K_DIR_MAX_LENGTH=80
POWERLEVEL9K_RULER_CHAR=$'\M-b\M-\C-T\M-\C-@'
POWERLEVEL9K_VCS_BACKENDS=( git )
POWERLEVEL9K_NODENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_FOREGROUND=76
POWERLEVEL9K_AWS_FOREGROUND=208
POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
POWERLEVEL9K_DIR_ANCHOR_BOLD=true
POWERLEVEL9K_NORDVPN_DISCONNECTED_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
POWERLEVEL9K_DIR_SHOW_WRITABLE=true
POWERLEVEL9K_BACKGROUND=''
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_CONTENT_EXPANSION=$'\M-b\M-\C-E\M-$'
POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
POWERLEVEL9K_GO_VERSION_FOREGROUND=37
POWERLEVEL9K_STATUS_ERROR=false
POWERLEVEL9K_DIR_FOREGROUND=31
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_CHAR=' '
POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}'
POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND=166
POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_ANACONDA_FOREGROUND=37
POWERLEVEL9K_NORDVPN_DISCONNECTED_CONTENT_EXPANSION=''
POWERLEVEL9K_LOAD_WARNING_FOREGROUND=178
POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION=$'\M-b\M-\C-\\M-\C-T'
POWERLEVEL9K_CONTEXT_SUDO_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_CONTEXT_DEFAULT_CONTENT_EXPANSION=''
POWERLEVEL9K_PROMPT_CHAR_OK_VICMD_CONTENT_EXPANSION=$'\M-b\M-\C-]\M-.'
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=' '
POWERLEVEL9K_SHORTEN_FOLDER_MARKER='(.bzr|.citc|.git|.hg|.node-version|.python-version|.ruby-version|.shorten_folder_marker|.svn|.terraform|CVS|Cargo.toml|composer.json|go.mod|package.json)'
POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=''
POWERLEVEL9K_LEFT_RIGHT_WHITESPACE=''
POWERLEVEL9K_NODENV_FOREGROUND=70
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_CONTENT_EXPANSION=$'\M-b\M-\C-V\M-6'
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIVIS_FOREGROUND=196
POWERLEVEL9K_NORDVPN_CONNECTING_CONTENT_EXPANSION=''
POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50
POWERLEVEL9K_NVM_FOREGROUND=70
POWERLEVEL9K_EXAMPLE_FOREGROUND=208
POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER=''
POWERLEVEL9K_GO_VERSION_PROJECT_ONLY=true
POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=160
POWERLEVEL9K_DIR_HYPERLINK=false
POWERLEVEL9K_LEFT_LEFT_WHITESPACE=''
POWERLEVEL9K_VCS_UNSTAGED_MAX_NUM=-1
POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_FOREGROUND=76
POWERLEVEL9K_VCS_STAGED_MAX_NUM=-1
POWERLEVEL9K_VIRTUALENV_FOREGROUND=37
POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=178
POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun))[0-9]*'
POWERLEVEL9K_BATTERY_LOW_FOREGROUND=160
POWERLEVEL9K_SHOW_RULER=false
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( status command_execution_time background_jobs virtualenv anaconda pyenv nodenv nvm nodeenv rbenv rvm kubecontext terraform aws context nordvpn ranger time )
POWERLEVEL9K_NODEENV_RIGHT_DELIMITER=''
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM=-1
POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=$'\M-b\M-\C-F\M-5'
POWERLEVEL9K_ANACONDA_LEFT_DELIMITER=''
POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE=%B%n@%m
POWERLEVEL9K_RIGHT_RIGHT_WHITESPACE=''
POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160
POWERLEVEL9K_PROMPT_CHAR_OK_VIINS_CONTENT_EXPANSION=$'\M-b\M-\C-]\M-/'
POWERLEVEL9K_TIME_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_STATUS_ERROR_PIPE=true
POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_NODEENV_FOREGROUND=70
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
POWERLEVEL9K_VCS_COMMITS_BEHIND_MAX_NUM=-1
POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION=$'\M-b\M-\C-\\M-\C-T'
POWERLEVEL9K_BATTERY_STAGES=$'\M-o\M-\C-V\M-\C-M\M-o\M-\C-U\M-9\M-o\M-\C-U\M-:\M-o\M-\C-U\M-;\M-o\M-\C-U\M-<\M-o\M-\C-U\M-=\M-o\M-\C-U\M->\M-o\M-\C-U\M-?\M-o\M-\C-V\M-\C-@\M-o\M-\C-V\M-\C-A\M-o\M-\C-U\M-8'
POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=''
POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=''
POWERLEVEL9K_PYENV_FOREGROUND=37
POWERLEVEL9K_VCS_UNTRACKED_MAX_NUM=-1
POWERLEVEL9K_DIR_CLASSES=(  )
POWERLEVEL9K_STATUS_OK_PIPE=true
POWERLEVEL9K_MODE=nerdfont-complete
POWERLEVEL9K_VCS_COMMITS_AHEAD_MAX_NUM=-1
POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
POWERLEVEL9K_RULER_FOREGROUND=240
POWERLEVEL9K_RBENV_FOREGROUND=168
TERM=xterm-256color
POWERLEVEL9K_DOTNET_VERSION_FOREGROUND=134
POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=$'\M-b\M-\C-F\M-5'
POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY=true
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=178
POWERLEVEL9K_STATUS_OK_FOREGROUND=70
POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION=''
POWERLEVEL9K_LOAD_WHICH=5
POWERLEVEL9K_CONTEXT_FOREGROUND=180
POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_CONTENT_EXPANSION=$'\M-b\M-\C-]\M-.'
POWERLEVEL9K_PROMPT_CHAR_ERROR_VICMD_FOREGROUND=196
POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=244
POWERLEVEL9K_NODEENV_SHOW_NODE_VERSION=false
POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=76
POWERLEVEL9K_STATUS_EXTENDED_STATES=true
POWERLEVEL9K_RANGER_FOREGROUND=178
POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_CONTENT_EXPANSION=$'\M-b\M-\C-V\M-6'
POWERLEVEL9K_NORDVPN_DISCONNECTING_CONTENT_EXPANSION=''
POWERLEVEL9K_NODE_VERSION_FOREGROUND=70
POWERLEVEL9K_ICON_BEFORE_CONTENT=true
POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=103
POWERLEVEL9K_OS_ICON_CONTENT_EXPANSION='%B${P9K_CONTENT// }'

Can you reproduce this from a shell started with the following command?

Not directly:
zsh_tmp1
As you can see, the indentation of TSTP still seems to be off, but the issue does not carry over to the subsequent line where the new command prompt is.

@romkatv
Copy link
Owner

romkatv commented Oct 8, 2019

When your right prompt shifts to the left -- this is the same issue. Let's try to narrow it down.

First of all, run this command and restart zsh:

git -C $ZSH_CUSTOM/themes/powerlevel10k pull

Now let's see if removing oh-my-zsh helps. Run this command:

(
  emulate -L zsh
  setopt no_unset err_return
  local tmp && tmp="$(mktemp -d ${TMPDIR:-/tmp}/p10k.XXXXXXXXXX)"
  {
    cd $tmp
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git
    >$tmp/.zshrc echo "
      source ${(q)tmp}/powerlevel10k/config/p10k-lean.zsh
      source ${(q)tmp}/powerlevel10k/powerlevel10k.zsh-theme
      typeset COLUMNS"
    ZDOTDIR=$tmp zsh
  } always {
    cd || true
    rm -rf $tmp
  }
)

Then type sleep 10&. Does prompt break? If so, type typeset COLUMNS. Is the output the same as a few lines above?

If prompt breaks even without oh-my-zsh, see if it breaks without powerlevel10k:

(
  emulate -L zsh
  setopt no_unset err_return
  local tmp && tmp="$(mktemp -d ${TMPDIR:-/tmp}/p10k.XXXXXXXXXX)"
  {
    cd $tmp
    >$tmp/.zshrc echo "
      setopt prompt_subst
      PROMPT='> '
      RPROMPT='\${\${(%):-%j}:#0} <'
      typeset COLUMNS"
    ZDOTDIR=$tmp zsh
  } always {
    cd || true
    rm -rf $tmp
  }
)

Same thing here: type sleep 10& and then typeset COLUMNS. Does right prompt shift? Does the value of COLUMNS change?

What terminal are you using? Can you reproduce it with a different terminal?

@dflaxx
Copy link
Author

dflaxx commented Oct 8, 2019

I stand corrected -- putting a fg process like vim to the background with Ctrl+Z is not the exact same thing as running sleep 10&. It seems to be the case when a one-line layout is used, but with the two-line layout as created by your first command (remove oh-my-zsh), it looks different:
zsh_tmp2
You can see that the green symbol after sleep 10& is not shifted to the left, but the TSTP text after suspending vim is.

I'm using the GNOME Terminal v3.32.2.

How should I proceed from here? Should I try the rest of your commands, but replace the sleep 10& check with putting vim in the background?

@romkatv
Copy link
Owner

romkatv commented Oct 8, 2019

How should I proceed from here? Should I try the rest of your commands, but replace the sleep 10& check with putting vim in the background?

Yes, that sounds good.

Basically, we are trying to reduce the test case to its absolute minimum.

@romkatv
Copy link
Owner

romkatv commented Oct 9, 2019

Did you have a chance to run the experiments I mentioned?

@dflaxx
Copy link
Author

dflaxx commented Oct 9, 2019

Sorry, not yet. I'm going to try and do it tomorrow or on Friday.

@dflaxx
Copy link
Author

dflaxx commented Oct 10, 2019

Here we go:

Now let's see if removing oh-my-zsh helps.

No, the prompt still breaks. Both before and after running the suggested command to run p10k w/o oh-my-zsh, COLUMNS=80.
zsh_1010_1

If prompt breaks even without oh-my-zsh, see if it breaks without powerlevel10k:

The prompt does not break:
zsh_1010_2

Thanks for your patience and help!

@dflaxx
Copy link
Author

dflaxx commented Oct 10, 2019

Another hint -- I suppose this is related: When I type something in the prompt and then, instead of issuing the command with Enter, abort using Ctrl+C, the cursor is also in the wrong position. After the next successful command (i.e., ">" becomes green), it's back to the correct position. The following screenshot was taken using my config:
zsh_1010_3

@romkatv
Copy link
Owner

romkatv commented Oct 10, 2019

In the future tests you can just hit ctrl-c (without typing anything) to make signal name (INT in this case) appear. Type true to clear it (this will also "resolve" the problem with stopped foreground jobs).

Going over your screenshots once again I see that all right prompts are shifted by 2 * N where N is the number of segments shown on the right. Even when you have only the clock, it's also shifted. You can verify this by typing sleep 10& and then hitting ctrl-c. Each command will shift right prompt 2 positions to the left.

The only exception to this rule is one prompt that has 6s on the right. This is command_execution_time segment and it shows up if the last command took over 3 seconds. It's weird that it's not shifted.

Please press ctrl-c while having your regular one-line prompt. You should have your right prompt shifted. Type print -rl -- ${(q+)RPROMPT} ${(eq+)RPROMPT} ${(m)#${(e)RPROMPT}} and post the output here as text (not a screenshot).

Can you reproduce this issue in docker? Here's the command:

docker run -e TERM -it --rm jonathonf/manjaro bash -uexc '
  pacman -Sy --noconfirm sed gzip zsh git
  sed -e "s/#en_US.UTF-8/en_US.UTF-8/" -i /etc/locale.gen
  locale-gen
  export LANG=en_US.UTF-8
  git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
  echo "source ~/powerlevel10k/config/p10k-lean.zsh" >>~/.zshrc
  echo "source ~/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc
  cd ~/powerlevel10k
  exec zsh'

Type sleep 10& and hit ctrl-c when prompt loads. Is right prompt shifted?

I've asked you earlier to try to reproduce this problem with a different terminal. Have you?

Can you guess what might be the cause of this problem? You are using the most popular version of zsh and one of the most popular terminals and yet you are the only one who experiences this issue. What's special about your setup? Any clue might help.

@dflaxx
Copy link
Author

dflaxx commented Oct 10, 2019

Please press ctrl-c while having your regular one-line prompt. You should have your right prompt shifted. Type print -rl -- ${(q+)RPROMPT} ${(eq+)RPROMPT} ${(m)#${(e)RPROMPT}} and post the output here as text (not a screenshot).

~ print -rl -- ${(q+)RPROMPT} ${(eq+)RPROMPT} ${(m)#${(e)RPROMPT}}
$'${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::=}}+}${${:-${P9K_CONTENT::=INT}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=43}}${_p9k_n:=${${$((_p9k_i>=1&&_p9k_i<1)):#0}:+44}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+45}}${_p9k_n:=46}${_p9k_v::="\M-b\M-\C-F\M-5"}${_p9k_c::="${P9K_CONTENT}"}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}1}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_v}${${(M)_p9k_e:#11}:+ }${_p9k_c}%b%k%160F${${:-${_p9k_w::=%b%k%160F}${_p9k_sss::=%b%k%160F}${_p9k_i::=1}${_p9k_bg::=}}+}}${${:-"${${(%):-%j}:#0}"}:+${${:-${P9K_CONTENT::=""}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=7}}${_p9k_n:=${${$((_p9k_i>=3&&_p9k_i<3)):#0}:+8}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+9}}${_p9k_n:=10}${P9K_VISUAL_IDENTIFIER::=\M-o\M-\C-@\M-\C-S }${_p9k_v::="${P9K_VISUAL_IDENTIFIER// }"%b%k%70F}${_p9k_c::="${P9K_CONTENT}"}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_v}${${(M)_p9k_e:#11}:+ }${_p9k_c}%b%k%70F${${:-${_p9k_w::=%b%k%70F}${_p9k_sss::=%b%k%70F}${_p9k_i::=3}${_p9k_bg::=}}+}}}${${:-${P9K_CONTENT::=%n@%m}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=11}}${_p9k_n:=${${$((_p9k_i>=15&&_p9k_i<15)):#0}:+12}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+13}}${_p9k_n:=14}${_p9k_c::=}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}0}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_c}%b%k%180F${${:-${_p9k_w::=%b%k%180F}${_p9k_sss::=%b%k%180F}${_p9k_i::=15}${_p9k_bg::=}}+}}${${:-${P9K_CONTENT::=}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=15}}${_p9k_n:=${${$((_p9k_i>=16&&_p9k_i<16)):#0}:+16}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+17}}${_p9k_n:=18}${P9K_VISUAL_IDENTIFIER::=}${_p9k_v::="${P9K_VISUAL_IDENTIFIER// }"%b%k%39F}${_p9k_c::="${P9K_CONTENT}"}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_v}${${(M)_p9k_e:#11}:+ }${_p9k_c}%b%k%39F${${:-${_p9k_w::=%b%k%39F}${_p9k_sss::=%b%k%39F}${_p9k_i::=16}${_p9k_bg::=}}+}}${${:-${P9K_CONTENT::=11:43:24}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=19}}${_p9k_n:=${${$((_p9k_i>=18&&_p9k_i<18)):#0}:+20}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+21}}${_p9k_n:=22}${_p9k_c::="${P9K_CONTENT}"}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}0}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_c}%b%k%66F${${:-${_p9k_w::=%b%k%66F}${_p9k_sss::=%b%k%66F}${_p9k_i::=18}${_p9k_bg::=}}+}}$_p9k_sss%b%k%f${${COLUMNS::=$_p9k_clm}+}'
$'%b%k%160F\M-b\M-\C-F\M-5 INT%b%k%160F%b%k%160F %b%k%66F11:43:24%b%k%66F%b%k%66F%b%k%f'
73

Can you reproduce this issue in docker?

No, no issue there. However, I cannot judge whether root@9f6d4fde0ad1 somewhat masks the right indentation, I leave that to you:
zsh_1010_docker

I've asked you earlier to try to reproduce this problem with a different terminal. Have you?

Any suggestion from your side on what terminal to try? I'm really no expert here.

Can you guess what might be the cause of this problem? You are using the most popular version of zsh and one of the most popular terminals and yet you are the only one who experiences this issue. What's special about your setup? Any clue might help.

The only thing I can think of is that zsh is not my default shell. This is due to our systems setup. When I open a terminal, it's bash, and I manually launch zsh. Otherwise, my system is a pretty standard Manjaro Linux with GNOME Terminal. If you have any suspicions about what incompatibilities are causing this, I'll happily look for any clues of this on my system.

@romkatv
Copy link
Owner

romkatv commented Oct 10, 2019

~ print -rl -- ${(q+)RPROMPT} ${(eq+)RPROMPT} ${(m)#${(e)RPROMPT}}
$'${${_p9k_clm::=$COLUMNS}+}${${COLUMNS::=1024}+}${${:-${_p9k_bg::=NONE}${_p9k_i::=0}${_p9k_sss::=}}+}${${:-${P9K_CONTENT::=INT}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=43}}${_p9k_n:=${${$((_p9k_i>=1&&_p9k_i<1)):#0}:+44}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+45}}${_p9k_n:=46}${_p9k_v::="\M-b\M-\C-F\M-5"}${_p9k_c::="${P9K_CONTENT}"}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}1}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_v}${${(M)_p9k_e:#11}:+ }${_p9k_c}%b%k%160F${${:-${_p9k_w::=%b%k%160F}${_p9k_sss::=%b%k%160F}${_p9k_i::=1}${_p9k_bg::=}}+}}${${:-"${${(%):-%j}:#0}"}:+${${:-${P9K_CONTENT::=""}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=7}}${_p9k_n:=${${$((_p9k_i>=3&&_p9k_i<3)):#0}:+8}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+9}}${_p9k_n:=10}${P9K_VISUAL_IDENTIFIER::=\M-o\M-\C-@\M-\C-S }${_p9k_v::="${P9K_VISUAL_IDENTIFIER// }"%b%k%70F}${_p9k_c::="${P9K_CONTENT}"}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_v}${${(M)_p9k_e:#11}:+ }${_p9k_c}%b%k%70F${${:-${_p9k_w::=%b%k%70F}${_p9k_sss::=%b%k%70F}${_p9k_i::=3}${_p9k_bg::=}}+}}}${${:-${P9K_CONTENT::=%n@%m}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=11}}${_p9k_n:=${${$((_p9k_i>=15&&_p9k_i<15)):#0}:+12}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+13}}${_p9k_n:=14}${_p9k_c::=}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}0}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_c}%b%k%180F${${:-${_p9k_w::=%b%k%180F}${_p9k_sss::=%b%k%180F}${_p9k_i::=15}${_p9k_bg::=}}+}}${${:-${P9K_CONTENT::=}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=15}}${_p9k_n:=${${$((_p9k_i>=16&&_p9k_i<16)):#0}:+16}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+17}}${_p9k_n:=18}${P9K_VISUAL_IDENTIFIER::=}${_p9k_v::="${P9K_VISUAL_IDENTIFIER// }"%b%k%39F}${_p9k_c::="${P9K_CONTENT}"}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}${${(%):-$_p9k_v%1(l.1.0)}[-1]}}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_v}${${(M)_p9k_e:#11}:+ }${_p9k_c}%b%k%39F${${:-${_p9k_w::=%b%k%39F}${_p9k_sss::=%b%k%39F}${_p9k_i::=16}${_p9k_bg::=}}+}}${${:-${P9K_CONTENT::=11:43:24}${_p9k_n::=}${${${_p9k_bg:-0}:#NONE}:-${_p9k_n::=19}}${_p9k_n:=${${$((_p9k_i>=18&&_p9k_i<18)):#0}:+20}}${_p9k_n:=${${(M)${:-x$_p9k_bg}:#x(|0)}:+21}}${_p9k_n:=22}${_p9k_c::="${P9K_CONTENT}"}${_p9k_e::=${${(%):-$_p9k_c%1(l.1.0)}[-1]}0}}+}${${_p9k_e:#00}:+${_p9k_t[$_p9k_n]/<_p9k_w>/$_p9k_w}${_p9k_c}%b%k%66F${${:-${_p9k_w::=%b%k%66F}${_p9k_sss::=%b%k%66F}${_p9k_i::=18}${_p9k_bg::=}}+}}$_p9k_sss%b%k%f${${COLUMNS::=$_p9k_clm}+}'
$'%b%k%160F\M-b\M-\C-F\M-5 INT%b%k%160F%b%k%160F %b%k%66F11:43:24%b%k%66F%b%k%66F%b%k%f'
73

This narrows it down quite a bit. That 73 is wrong. It should be 71. Let's see what causes it.

Post the output of this:

print -lr --                                                                                           \
  ${(m)#${:-$'%b%k%160F\M-b\M-\C-F\M-5 INT%b%k%160F%b%k%160F %b%k%66F11:43:24%b%k%66F%b%k%66F%b%k%f'}} \
  ${(m)#${:-$'\M-b\M-\C-F\M-5 INT%b%k%160F%b%k%160F %b%k%66F11:43:24%b%k%66F%b%k%66F%b%k%f'}}          \
  ${(m)#${:-$' INT%b%k%160F%b%k%160F %b%k%66F11:43:24%b%k%66F%b%k%66F%b%k%f'}}                         \
  ${(m)#${:-$'%b%k%160F%b%k%160F %b%k%66F11:43:24%b%k%66F%b%k%66F%b%k%f'}}                             \
  ${(m)#${:-$' %b%k%66F11:43:24%b%k%66F%b%k%66F%b%k%f'}}                                               \
  ${(m)#${:-$'11:43:24%b%k%66F%b%k%66F%b%k%f'}}                                                        \
  ${(m)#${:-$'%b%k%66F%b%k%66F%b%k%f'}}                                                                \
  ${(m)#${:-$'%b%k%66F%b%k%f'}}                                                                        \
  ${(m)#${:-$'%b%k%f'}}

Also this:

zmodload zsh/parameter
echo $options[multibyte]
locale

And this:

print -lr -- $'>\u21b5<' ${(m)#${:-$'\u21b5'}}

Any suggestion from your side on what terminal to try? I'm really no expert here.

This is no longer necessary. The problem isn't with your terminal.

No, no issue there. However, I cannot judge whether root@9f6d4fde0ad1 somewhat masks the right indentation, I leave that to you.

That root@9f6d4fde0ad1 shouldn't make a difference. The conclusion of this test is that zsh is broken on your machine. Since ZSH_PATCHLEVEL on your machine is the same as in the stock installation of manjaro (e.g., that docker image), it means something in your environment is broken, likely related to locale. Test above should reveal more info.

@dflaxx
Copy link
Author

dflaxx commented Oct 10, 2019

Post the output of this:

73
64
61
57
39
30
22
14
6

Also this:

on
LANG=de_DE.UTF-8
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C

And this:

zsh: character not in range

I found it! My .bashrc included the following line to set the terminal language to English, although I'm using a German system: export LC_ALL=C. Removing that line fixed the issue.

What is the correct way to set the terminal output to English in my case? Obviously, my approach broke something.

@romkatv
Copy link
Owner

romkatv commented Oct 10, 2019

Obviously, my approach broke something.

Yes, it broke UTF-8 support.

Locale C is not English, it's country-agnostic. C without UTF encoding is simply ASCII. Changing locale in ~/.bashrc is almost always a bad idea. The correct way to do it is via your system settings. Read https://wiki.archlinux.org/index.php/Locale or ask your system administrator if you have one.

If you really want to do it via ~/.bashrc and risk having different locales in different apps (this will make sorting inconsistent, etc.), type locale -a to see the list of available locales. Choose one that starts with en and ends with UTF-8. The most common choice is en_US.UTF-8, which is virtually the de facto standard locale in the international tech community. (FWIW, I use C.UTF-8.) If you don't have this locale, you need to generate it. This requires root access. Since you said you cannot change your default shell to zsh, I suppose this is because zsh is not listed in /etc/shells and you cannot add it because you don't have root access. If this is correct, then you also cannot install locales (or maybe there is a way to do it within your user directory? I'm not sure.)

I'm going to close this issue as it's not related to p10k and you are on the way to fix your system properly.

@romkatv romkatv closed this as completed Oct 10, 2019
@dflaxx
Copy link
Author

dflaxx commented Oct 10, 2019

Thanks a lot for your time and effort, I appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants