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

Completion waiting dots cause prompt to disappear with multi line prompts #5765

Closed
chrishoage opened this issue Jan 9, 2017 · 16 comments
Closed
Labels
Area: theme Issue or PR related to a theme Bug Something isn't working Resolution: not our issue Issue or pull request not related to Oh My Zsh Topic: completion Pull Request or issue regarding completion

Comments

@chrishoage
Copy link

With completion waiting dots off:
screen shot 2017-01-09 at 1 47 51 pm

With completion waiting dots on:
screen shot 2017-01-09 at 1 48 08 pm

This issue is not specific to my custom theme. I have tried other multi line prompts and all have the same issue.

In the meantime I have disabled COMPLETION_WAITING_DOTS

huiyiqun added a commit to huiyiqun/dotfiles that referenced this issue May 21, 2017
@daneah
Copy link

daneah commented Sep 29, 2017

I didn't experience this issue until upgrading to macOS High Sierra. I asked this StackOverflow question before finally tracing the issue to COMPLETION_WAITING_DOTS myself. Looked into that code but wasn't able to make much sense of it on first go around 😅

@mcornella
Copy link
Member

Can you test with this modification?

expand-or-complete-with-dots() {
    print -Pn "%{%F{red}......%f%}"

    zle expand-or-complete
    zle redisplay
}
zle -N expand-or-complete-with-dots
bindkey '^I' expand-or-complete-with-dots

@daneah
Copy link

daneah commented Sep 3, 2018

@mcornella I've just tried this and I'm still seeing the same behavior. I believe the zle redisplay is what causes this affliction, as commenting it out makes things behave roughly as I'd expect. There are obviously a few other issues that come out of just removing that, though.

@mcornella
Copy link
Member

Sadly I can't reproduce this. Can you share your theme so I can try on my end? Also, what zsh --version are you running?

@daneah
Copy link

daneah commented Sep 3, 2018

I'm on zsh 5.5.1 (x86_64-apple-darwin17.5.0) on macOS 10.13.4.

My theme is a fairly heavily customized one, originally started from kolo. Here's the theme.

@daneah
Copy link

daneah commented Sep 3, 2018

I attempted to make an asciinema recording of this behavior to help you see a little more clearly what's happening, but asciinema drops you into a subshell where it seems that the completion dots don't execute (and therefore the behavior is not exhibited). I don't quite understand why that is, but sorry if that observation is just noise 😅

@shilov
Copy link

shilov commented Sep 5, 2018

@mcornella just tried your modification and the issue is still present.

Also running zsh 5.5.1, but with the denysdovhan/spaceship-prompt theme.
As @daneah pointed out, the issue seems to be related to zle redisplay

@mcornella
Copy link
Member

I can't reproduce the issue with either of your themes even with the same zsh version.

These are two modified versions, please try both and report if the issue persists (you can copy-paste directly into the terminal):

Version 1

expand-or-complete-with-dots() {
    # toggle line-wrapping off and back on again
    [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
    print -Pn "%{%F{red}......%f%}"
    [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam

    zle expand-or-complete
    zle -R
}
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots

Version 2

expand-or-complete-with-dots() {
    # toggle line-wrapping off and back on again
    [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
    print -Pn "%{%F{red}......%f%}"
    [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam

    zle expand-or-complete
    zle reset-prompt
}
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots

@daneah
Copy link

daneah commented Sep 8, 2018

@mcornella I tried these both.

The first approach no longer overwrites the terminal prompt, but does result in the dots interrupting the line currently being typed:

ls /va.....ar/li.....ib/...../postfix/

The second approach works well unless I hit <TAB> <TAB> to cycle through argument options, i.e.:

ls /va<TAB>
ls /va...
ls /var/
ls /var/<TAB>

Doing that still exhibits the removal of the prompt.

@daneah
Copy link

daneah commented Sep 8, 2018

Since you can't reproduce this I'm wondering if a particular plugin is to blame. I will try keeping completion dots on and turning off various plugins to see if I can narrow that down.

Edit: Turned off all plugins and behavior was still present 😕

@juanibiapina
Copy link

I have this problem as well. I don't use oh my zsh, but copied over just the COMPLETION_WAITING_DOTS part. My prompt is also custom with two lines (and right prompt as well).

@juanibiapina
Copy link

juanibiapina commented Feb 12, 2019

The same problem happens when using fzf for file completion. Both of these probably call zle redisplay, causing the issue. There is a workaround suggested here: https://superuser.com/questions/382503/how-can-i-put-a-newline-in-my-zsh-prompt-without-causing-terminal-redraw-issues

Also more information here: sorin-ionescu/prezto#1245

ERRATA: Actually fzf is now calling zle reset-prompt, which is also broken.

zle -R seems to work well for both cases.

@mcornella mcornella added Area: theme Issue or PR related to a theme Topic: completion Pull Request or issue regarding completion Bug Something isn't working labels May 12, 2019
tbrixen pushed a commit to tbrixen/dotfiles that referenced this issue Jul 2, 2019
There is a bug for oh-my-zsh not solved yet.
This is described in ohmyzsh/ohmyzsh#5765
sudo-suhas added a commit to sudo-suhas/oh-my-zsh that referenced this issue Nov 4, 2019
Enabling this setting causes issues for multiline prompts when tab
completion is triggered. Add a caution in template warning against the
same.
See ohmyzsh#5765
@segevfiner
Copy link

segevfiner commented Nov 12, 2019

This feels like a zsh/zle bug. I'm not seeing this with zsh 5.7.1 but have seen it before. We should probably figure out which zsh version or commit fixed this or maybe my prompt worked around this. I'm using spaceship prompt.

@mcornella
Copy link
Member

mcornella commented Dec 28, 2019

Latest versions of zsh don't have this bug, so I'll close this as an upstream issue. Confirmed to be fixed in 5.7.1 and buggy in 5.3, I don't know the oldest version with a fix.

@mcornella mcornella added the Resolution: not our issue Issue or pull request not related to Oh My Zsh label Dec 28, 2019
@juanibiapina
Copy link

juanibiapina commented Dec 29, 2019

To be more specific: this is fixed for me on zsh 5.7.1, but not when inside tmux 3.0a. I'd appreciate any ideas here.

@negebauer
Copy link

I had a similar issue and changing the locale fixed it #7558 (comment)

subich added a commit to subich/dotfiles that referenced this issue Aug 12, 2021
# Path to your oh-my-zsh installation.
export ZSH="/Users/stefansubich/.oh-my-zsh"

ZSH_DISABLE_COMPFIX=true

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"

# 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 if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="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.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See ohmyzsh/ohmyzsh#5765
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.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
HIST_STAMPS="yyyy-mm-dd"

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Add wisely, as too many plugins slow down shell startup.
plugins=(
    command-not-found
    zsh-syntax-highlighting
    extract
    fzf
    git
    thefuck
    timer
    vi-mode
    web-search
)

source $ZSH/oh-my-zsh.sh

# User configuration
# vi-like keybinds
bindkey -v

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

TIMER_THRESHOLD=15

VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true
VI_MODE_SET_CURSOR=true

# aliases for better versions of some common programs
alias cat='bat'
alias ping='prettyping --nolegend'
alias du="ncdu -rr -x"

# Slightly hacky fix for awslocal
export USE_LEGACY_PORTS=1

# enable mastermind alias
alias mm="python3 $HOME/aver/devproxy/mastermind.py"

# global bbm tool alias
export MM="$HOME/aver/devproxy/mastermind.py"
alias bbm="$HOME/aver/bbm/bbmdev-tools/bin/bbm"
alias check_arns="$HOME/aver/bbm/bbmdev-tools/bin/check_arns"

# set NPM token
export NPM_TOKEN=9156cd80-2f49-4e9e-8662-e2d2984f4529

# initialize `fuck`
#eval $(thefuck --alias)
# init pyenv
eval "$(pyenv init -)"

test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: theme Issue or PR related to a theme Bug Something isn't working Resolution: not our issue Issue or pull request not related to Oh My Zsh Topic: completion Pull Request or issue regarding completion
Projects
None yet
Development

No branches or pull requests

7 participants