Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Prompt with newline causes previous lines to be deleted when tab autocompleting #668

Closed
dededecline opened this issue Nov 8, 2017 · 15 comments

Comments

@dededecline
Copy link

dededecline commented Nov 8, 2017

When I have at least one of

POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_PROMPT_ON_NEWLINE=true

enabled in my zshrc, I experience an issue when using tab autocompletion where it will redraw the prompt, but it will cover up the preceding line.

Specs: MacOS 10.13.1, iTerm2 Build 3.1.5, zsh 5.4.2, latest version of master for both oh-my-zsh and powerlevel9k.

My .zshrc:

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH=/Users/<user>/.oh-my-zsh

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="powerlevel9k/powerlevel9k"

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git sublime solarized-man)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#
alias brewup='brew update; brew upgrade; brew prune; brew cleanup; brew doctor'
alias config='vim ~/.ssh/config'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
alias json='jq .'
alias ls='ls -G'
alias paths='ls -ld $(find .)'
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias search='grep -rnw . -e'
alias tulip='lsof -i -n -P'

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

POWERLEVEL9K_ALWAYS_SHOW_USER=true
POWERLEVEL9K_CONTEXT_TEMPLATE="%n"
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=""
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%{%F{249}%}\u2517%{%F{default}%} "
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time zsh_showStatus)
POWERLEVEL9K_SHORTEN_DIR_LENGTH=4
POWERLEVEL9K_SHORTEN_STRATEGY=truncate_folders
POWERLEVEL9K_SHORTEN_DELIMITER=""
POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=true
POWERLEVEL9K_STATUS_VERBOSE=false

POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="black"
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="249"
POWERLEVEL9K_DIR_HOME_BACKGROUND="black"
POWERLEVEL9K_DIR_HOME_FOREGROUND="249"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="black"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="249"
POWERLEVEL9K_OS_ICON_BACKGROUND="black"
POWERLEVEL9K_OS_ICON_FOREGROUND="249"
POWERLEVEL9K_STATUS_ERROR_BACKGROUND="black"
POWERLEVEL9K_STATUS_ERROR_FOREGROUND="red"
POWERLEVEL9K_STATUS_OK_BACKGROUND="black"
POWERLEVEL9K_STATUS_OK_FOREGROUND="green"
POWERLEVEL9K_TODO_BACKGROUND="black"
POWERLEVEL9K_TODO_FOREGROUND="249"
POWERLEVEL9K_NVM_BACKGROUND="black"
POWERLEVEL9K_NVM_FOREGROUND="249"
POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_COLOR="green"
POWERLEVEL9K_RVM_BACKGROUND="black"
POWERLEVEL9K_RVM_FOREGROUND="249"
POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_COLOR="red"
POWERLEVEL9K_LOAD_CRITICAL_BACKGROUND="black"
POWERLEVEL9K_LOAD_WARNING_BACKGROUND="black"
POWERLEVEL9K_LOAD_NORMAL_BACKGROUND="black"
POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND="249"
POWERLEVEL9K_LOAD_WARNING_FOREGROUND="249"
POWERLEVEL9K_LOAD_NORMAL_FOREGROUND="249"
POWERLEVEL9K_LOAD_CRITICAL_VISUAL_IDENTIFIER_COLOR="red"
POWERLEVEL9K_LOAD_WARNING_VISUAL_IDENTIFIER_COLOR="yellow"
POWERLEVEL9K_LOAD_NORMAL_VISUAL_IDENTIFIER_COLOR="green"
POWERLEVEL9K_RAM_BACKGROUND="black"
POWERLEVEL9K_RAM_FOREGROUND="249"
POWERLEVEL9K_RAM_ELEMENTS=(ram_free)
POWERLEVEL9K_BATTERY_LOW_BACKGROUND="black"
POWERLEVEL9K_BATTERY_CHARGING_BACKGROUND="black"
POWERLEVEL9K_BATTERY_CHARGED_BACKGROUND="black"
POWERLEVEL9K_BATTERY_DISCONNECTED_BACKGROUND="black"
POWERLEVEL9K_BATTERY_LOW_FOREGROUND="249"
POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND="249"
POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND="249"
POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND="249"
POWERLEVEL9K_BATTERY_LOW_VISUAL_IDENTIFIER_COLOR="red"
POWERLEVEL9K_BATTERY_CHARGING_VISUAL_IDENTIFIER_COLOR="yellow"
POWERLEVEL9K_BATTERY_CHARGED_VISUAL_IDENTIFIER_COLOR="green"
POWERLEVEL9K_BATTERY_DISCONNECTED_VISUAL_IDENTIFIER_COLOR="249"
POWERLEVEL9K_TIME_BACKGROUND="black"
POWERLEVEL9K_TIME_FOREGROUND="249"
POWERLEVEL9K_TIME_FORMAT="\uf017 %D{%H:%M:%S}"

export PATH="/usr/local/sbin:$PATH"
export PATH="/Users/<user>/bin:$PATH"
export PATH=$PATH:/usr/local/bin  

prompt_zsh_showStatus () {
	local color='%F{white}'
  state=`osascript -e 'tell application "Spotify" to player state as string'`;
  if [ $state = "playing" ]; then
    artist=`osascript -e 'tell application "Spotify" to artist of current track as string'`;
    track=`osascript -e 'tell application "Spotify" to name of current track as string'`;

      echo -n "%{$color%} \uf424  $artist - $track " ;

  fi
}
@bhilburn
Copy link
Member

Hey @danielhklein! I'm using an almost identical system, and can't seem to reproduce the issue with your newline settings. Can you share a screenshot so we can get a better idea of what's happening?

@dededecline
Copy link
Author

Hi @bhilburn thanks for the response, I uploaded a gif of the issue in action

@jordanweaver
Copy link

I'm also experiencing this exact issue for tab-completions and happy to help debug if needed.

my .zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=""
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="» "
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(virtualenv context dir vcs)
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(icons_test)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
POWERLEVEL9K_SHOW_CHANGESET=true
POWERLEVEL9K_CHANGESET_HASH_LENGTH=7
POWERLEVEL9K_PYTHON_ICON=
POWERLEVEL9K_VCS_GIT_GITHUB_ICON=$'\uF408'
POWERLEVEL9K_VCS_COMMIT_ICON=""

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Uncomment to hide the “user@hostname” in the window title
# DEFAULT_USER=jweaver

# Uncomment following line if you want to enable command auto-correction
# ENABLE_CORRECTION="true"

# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how often before auto-updates occur? (in days)
export UPDATE_ZSH_DAYS=14

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"

# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment following line if you want to  shown in the command execution time stamp
# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|
# yyyy-mm-dd
# HIST_STAMPS="mm/dd/yyyy"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git github python osx zsh-syntax-highlighting history-substring-search)

source $ZSH/oh-my-zsh.sh

########################
# CUSTOM STARTUP ITEMS #
########################


for DOTFILE in ~/.{aliases,exports,functions,path}; do
    [ -f "$DOTFILE" ] && . "$DOTFILE"
done

# Archey Terminal Splash
archey --color

# Z
. ~/devo/repos/z/z.sh

# use bash ctrl-U behavior
bindkey '^U' backward-kill-line

# edm auto-completion
autoload bashcompinit
bashcompinit
source ~/.edm-completion.bash

export VIRTUAL_ENV_DISABLE_PROMPT=1

test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

@bhilburn
Copy link
Member

bhilburn commented Dec 5, 2017

Wow... that's horrible. I am also on macOS, with ZSH 5.4.2, running latest OMZ and the next branch of P9k, and don't see this behavior. Additionally, there doesn't seem to be any really obvious things in your zshrcs that might be causing this.

I am on iTerm 3.0.15 - I wonder if something changed in a more recent version? @jordanweaver, what version of iTerm are you using?

If lots of people were seeing this issue, I would expect to have a lot more reports. I have to assume that there is something small, here, causing the problem.

How did you both install zsh, by the way?

(By the way, sorry for the slow response, here, everyone. I'm back and ready to solve this problem with you =) )

@dededecline
Copy link
Author

dededecline commented Dec 5, 2017

Hey @bhilburn I have zsh installed via homebrew

> which zsh
/usr/local/bin/zsh

> brew list | grep zsh
zsh
zsh-syntax-highlighting

@jordanweaver
Copy link

I'm using iTerm2 Build 3.1.5. It's been a while but I think I have oh-my-zsh from source (likely following these instructions) and using the system zsh:

image

@dededecline
Copy link
Author

@bhilburn @jordanweaver I've got an update, I've managed to get the issue to stop. I'll look later for root cause but commenting out

COMPLETION_WAITING_DOTS="true"

then source ~/.zshrc and restarting iTerm fixed the issue for me

@bhilburn
Copy link
Member

@danielhklein - Wow! Thanks so much for the update! I'm so happy you were able to find a fix. I actually have the waiting dots turned on, too, and don't see that issue. What a bizarre bug.

I'm going to add this to our troubleshooting wiki. Thanks for sharing your fix =)

@PetarMetodiev
Copy link

I have the same issue, but i am using Prezto.

My .zshrc:
#
# Executes commands at the start of an interactive session.
#
# Authors:
#   Sorin Ionescu <[email protected]>
#

POWERLEVEL9K_MODE='nerdfont-complete'
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
  source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi

stty stop ''
stty start ''
stty -ixon
stty -ixoff

setopt autopushd

# Customize to your needs...
#
# alias ld='ls -lAGh -p --color --group-directories-first'
alias ld='colorls -1A --sd'

# https://github.com/Homebrew/homebrew-command-not-found#install
# Used for https://github.com/sorin-ionescu/prezto/tree/master/modules/command-not-found
if brew command command-not-found-init > /dev/null 2>&1; then eval "$(brew command-not-found-init)"; fi

# Based on https://github.com/bhilburn/powerlevel9k/wiki/Show-Off-Your-Config#v1rguls-configuration
POWERLEVEL9K_DIR_PATH_SEPARATOR=" $(print_icon "LEFT_SUBSEGMENT_SEPARATOR") "
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION="" # HOUSE ICON
#
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0

POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND='black'
POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND='178'
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND="015"

POWERLEVEL9K_DIR_HOME_FOREGROUND="white"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="white"
POWERLEVEL9K_DIR_HOME_BACKGROUND="98"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="98"

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir dir_writable vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(vi_mode)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true

POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=''
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%K{white}%F{black} \Uf179 %f%k%F{white}%f "

POWERLEVEL9K_VI_MODE_NORMAL_BACKGROUND='red'
POWERLEVEL9K_VI_MODE_NORMAL_FOREGROUND='white'

POWERLEVEL9K_SHOW_CHANGESET=true
And my .zpreztorc:
#
# Sets Prezto options.
#
# Authors:
#   Sorin Ionescu <[email protected]>
#

#
# General
#

# Set case-sensitivity for completion, history lookup, etc.
# zstyle ':prezto:*:*' case-sensitive 'yes'

# Color output (auto set to 'no' on dumb terminals).
zstyle ':prezto:*:*' color 'yes'

# Add additional directories to load prezto modules from
# zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib

# Set the Zsh modules to load (man zshmodules).
# zstyle ':prezto:load' zmodule 'attr' 'stat'

# Set the Zsh functions to load (man zshcontrib).
# zstyle ':prezto:load' zfunction 'zargs' 'zmv'

# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
  'gnu-utility' \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'git' \
  'tmux' \
  'homebrew' \
  'utility' \
  'completion' \
  'syntax-highlighting' \
  'autosuggestions' \
  'history-substring-search' \
  'prompt'

#
# Autosuggestions
#

# Set the query found color.
zstyle ':prezto:module:autosuggestions:color' found 'red'

#
# Completions
#

# Set the entries to ignore in static */etc/hosts* for host completion.
# zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \
#   '0.0.0.0' '127.0.0.1'

#
# Editor
#

# Set the key mapping style to 'emacs' or 'vi'.
zstyle ':prezto:module:editor' key-bindings 'vi'

# Auto convert .... to ../..
# zstyle ':prezto:module:editor' dot-expansion 'yes'

# Allow the zsh prompt context to be shown.
# zstyle ':prezto:module:editor' ps-context 'yes'

#
# Git
#

# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'.
# zstyle ':prezto:module:git:status:ignore' submodules 'all'

#
# GNU Utility
#

# Set the command prefix on non-GNU systems.
# zstyle ':prezto:module:gnu-utility' prefix 'g'

#
# History Substring Search
#

# Set the query found color.
# zstyle ':prezto:module:history-substring-search:color' found ''

# Set the query not found color.
# zstyle ':prezto:module:history-substring-search:color' not-found ''

# Set the search globbing flags.
# zstyle ':prezto:module:history-substring-search' globbing-flags ''

#
# OS X
#

# Set the keyword used by `mand` to open man pages in Dash.app
# zstyle ':prezto:module:osx:man' dash-keyword 'manpages'

#
# Pacman
#

# Set the Pacman frontend.
# zstyle ':prezto:module:pacman' frontend 'yaourt'

#
# Prompt
#

# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
zstyle ':prezto:module:prompt' theme 'powerlevel9k'

# Set the working directory prompt display length.
# By default, it is set to 'short'. Set it to 'long' (without '~' expansion)
# for longer or 'full' (with '~' expansion) for even longer prompt display.
# zstyle ':prezto:module:prompt' pwd-length 'short'

# Set the prompt to display the return code along with an indicator for non-zero
# return codes. This is not supported by all prompts.
# zstyle ':prezto:module:prompt' show-return-val 'yes'

#
# Ruby
#

# Auto switch the Ruby version on directory change.
# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes'

#
# Python
#

# Auto switch the Python virtualenv on directory change.
# zstyle ':prezto:module:python:virtualenv' auto-switch 'yes'

# Automatically initialize virtualenvwrapper if pre-requisites are met.
# zstyle ':prezto:module:python:virtualenv' initialize 'yes'

#
# Screen
#

# Auto start a session when Zsh is launched in a local terminal.
# zstyle ':prezto:module:screen:auto-start' local 'yes'

# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:screen:auto-start' remote 'yes'

#
# SSH
#

# Set the SSH identities to load into the agent.
# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github'

#
# Syntax Highlighting
#

# Set syntax highlighters.
# By default, only the main highlighter is enabled.
zstyle ':prezto:module:syntax-highlighting' highlighters \
  'main' \
  'brackets' \
#   'pattern' \
#   'line' \
#   'cursor' \
#   'root'
#
# Set syntax highlighting styles.
# zstyle ':prezto:module:syntax-highlighting' styles \
#   'builtin' 'bg=blue' \
#   'command' 'bg=blue' \
#   'function' 'bg=blue'
#
# Set syntax pattern styles.
# zstyle ':prezto:module:syntax-highlighting' pattern \
#   'rm*-rf*' 'fg=white,bold,bg=red'

#
# Terminal
#

# Auto set the tab and window titles.
# zstyle ':prezto:module:terminal' auto-title 'yes'

# Set the window title format.
# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'

# Set the tab title format.
# zstyle ':prezto:module:terminal:tab-title' format '%m: %s'

# Set the terminal multiplexer title format.
# zstyle ':prezto:module:terminal:multiplexer-title' format '%s'

#
# Tmux
#

# Auto start a session when Zsh is launched in a local terminal.
# zstyle ':prezto:module:tmux:auto-start' local 'yes'

# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'

# Integrate with iTerm2.
zstyle ':prezto:module:tmux:iterm' integrate 'yes'

# Set the default session name:
# zstyle ':prezto:module:tmux:session' name 'YOUR DEFAULT SESSION NAME'

#
# Utility
#

# Enabled safe options. This aliases cp, ln, mv and rm so that they prompt
# before deleting or overwriting files. Set to 'no' to disable this safer
# behavior.
# zstyle ':prezto:module:utility' safe-ops 'yes'

@orkunsenturk
Copy link

orkunsenturk commented Dec 16, 2018

I have this issue when the rprompt newline is set to false

POWERLEVEL9K_RPROMPT_ON_NEWLINE=false

When i set it to true it works fine
May be this helps.

@phisco
Copy link

phisco commented Jul 14, 2019

@danielhklein you saved me

@romkatv
Copy link

romkatv commented Jul 15, 2019

@phisco Could you help with debugging this?

  1. Copy-paste the following code and post its output here.
() {
  echo ZSH_VERSION=$ZSH_VERSION
  echo ZSH_PATCHLEVEL=$ZSH_PATCHLEVEL
  [[ -n $terminfo[rmam] ]] && echo "rmam supported"
  [[ -n $terminfo[smam] ]] && echo "smam supported"
  if [[ -n $terminfo[rmam] && -n $terminfo[smam] ]]; then
    echoti rmam || echo "error: echoti rmam"
    echoti smam || echo "error: echoti smam"
  fi
  echo "expand-or-complete: $widgets[expand-or-complete]"
  echo "redisplay: $widgets[redisplay]"
}
  1. Paste the following code. Does anything change in your terminal after one second?
TRAPALRM() { zle redisplay; unset TMOUT }
TMOUT=1
  1. Same as (2) with this code:
TRAPALRM() { zle .redisplay; unset TMOUT }
TMOUT=1

@phisco
Copy link

phisco commented Jul 16, 2019

  1. the output is:
ZSH_VERSION=5.3
ZSH_PATCHLEVEL=zsh-5.3-0-g4cfdbdb
expand-or-complete: user:_zsh_highlight_widget_orig-s0.0000030000-r3094-expand-or-complete
redisplay: user:_zsh_highlight_widget_orig-s0.0000030000-r3094-redisplay
  1. nothing changed
  2. nothing changed

@romkatv
Copy link

romkatv commented Jul 16, 2019

@phisco Thanks! This is useful.

Let's see if this patch will fix it. Please run the following command. Copy-paste it exactly, including the leading and trailing parentheses.

(
cd $ZSH
git apply <<END
diff --git a/lib/completion.zsh b/lib/completion.zsh
index c7db2eb7..a7126217 100644
--- a/lib/completion.zsh
+++ b/lib/completion.zsh
@@ -66,6 +66,7 @@ if [[ \$COMPLETION_WAITING_DOTS = true ]]; then
     [[ -n "\$terminfo[rmam]" && -n "\$terminfo[smam]" ]] && echoti smam
 
     zle expand-or-complete
+    zle -R
     zle redisplay
   }
   zle -N expand-or-complete-with-dots
END
)

Then put COMPLETION_WAITING_DOTS=true in your ~/.zshrc and restart zsh. Does it fix the issue you had? If it does, I'll send a PR to oh-my-zsh so that it's fixed for everyone.

Once you are done testing, you can revert the patch with this command:

(
cd $ZSH
git checkout -- lib/completion.zsh
)

@ottodevs
Copy link

ottodevs commented Oct 2, 2019

@phisco Thanks! This is useful.

Let's see if this patch will fix it. Please run the following command. Copy-paste it exactly, including the leading and trailing parentheses.

(
cd $ZSH
git apply <<END
diff --git a/lib/completion.zsh b/lib/completion.zsh
index c7db2eb7..a7126217 100644
--- a/lib/completion.zsh
+++ b/lib/completion.zsh
@@ -66,6 +66,7 @@ if [[ \$COMPLETION_WAITING_DOTS = true ]]; then
     [[ -n "\$terminfo[rmam]" && -n "\$terminfo[smam]" ]] && echoti smam
 
     zle expand-or-complete
+    zle -R
     zle redisplay
   }
   zle -N expand-or-complete-with-dots
END
)

Then put COMPLETION_WAITING_DOTS=true in your ~/.zshrc and restart zsh. Does it fix the issue you had? If it does, I'll send a PR to oh-my-zsh so that it's fixed for everyone.

Once you are done testing, you can revert the patch with this command:

(
cd $ZSH
git checkout -- lib/completion.zsh
)

I tried applying the patch and I am afraid it didn't solve the issue, was this issue eventually fixed at some point?

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

No branches or pull requests

8 participants