From 3976e040350bd9ac9423252b97dee28d3762adc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 19 Aug 2015 09:03:43 +0200 Subject: [PATCH 1/3] Use proper if comparison --- lib/completion.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 452c0dfe7..e848ea2dd 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -58,7 +58,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ # ... unless we really want to. zstyle '*' single-ignored show -if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then +if [[ $COMPLETION_WAITING_DOTS = true ]]; then expand-or-complete-with-dots() { echo -n "\e[31m......\e[0m" zle expand-or-complete From 6a8d406eaa715814dc5a6df08960d1fe62e5c066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 16 Aug 2015 22:19:59 +0200 Subject: [PATCH 2/3] Use prompt expansion sequence to color red the output This makes it clearer and possibly more portable for different platforms. --- lib/completion.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index e848ea2dd..81250d9e1 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -60,7 +60,7 @@ zstyle '*' single-ignored show if [[ $COMPLETION_WAITING_DOTS = true ]]; then expand-or-complete-with-dots() { - echo -n "\e[31m......\e[0m" + print -Pn "%{%F{red}......%f%}" zle expand-or-complete zle redisplay } From b42efeb87ebdcb89510b8ffbcf210494f194109e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 22 Aug 2015 21:21:41 +0200 Subject: [PATCH 3/3] Switch off line wrapping in case dots occupy extra line This commit uses the (hopefully) standard rmam and smam escape sequences which toggle off and on line wrapping respectively. This is so that extra dots that don't fit the current line won't be displayed in the next line, which would in turn make the shell display a new prompt on the next line after the dots are hidden. I've added a check for $terminfo rmam and smam values to be sure we have them before printing them out. If this commit breaks something post an issue with your terminal emulator and $TERM value and we'll figure out what went wrong. --- lib/completion.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/completion.zsh b/lib/completion.zsh index 81250d9e1..f5b292471 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -60,7 +60,11 @@ zstyle '*' single-ignored show if [[ $COMPLETION_WAITING_DOTS = true ]]; then 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 redisplay }