From b164ae7bc70978131c2515bca4cb3bcaf3f95dbc Mon Sep 17 00:00:00 2001 From: Marlon Richert Date: Sun, 4 Jul 2021 14:29:48 +0300 Subject: [PATCH] Improve `all-matches` performance --- completion/_autocomplete.unambiguous | 2 +- module/.autocomplete.async | 7 ++++++- module/.autocomplete.config | 7 ------- run-tests.zsh | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/completion/_autocomplete.unambiguous b/completion/_autocomplete.unambiguous index 905ff3ab..98ceb2fe 100644 --- a/completion/_autocomplete.unambiguous +++ b/completion/_autocomplete.unambiguous @@ -24,5 +24,5 @@ local tag=unambiguous _tags $tag _tags && _requested $tag && _message -e unambiguous \ - $'%B%{\e[2m%}Shift-Tab:%b %{\e[2m%}insert %b%F{0}%K{11}'"$compstate[unambiguous]%f%k" + $'%{\e[1;2;39m%}common substring:%b %F{0}%K{11}'"$compstate[unambiguous]%f%k" # \e[2m = faint; 0 = black; 11 = bright yellow diff --git a/module/.autocomplete.async b/module/.autocomplete.async index 8c0bda4b..51aba2c0 100644 --- a/module/.autocomplete.async +++ b/module/.autocomplete.async @@ -133,8 +133,13 @@ zle -N history-incremental-search-forward .autocomplete.async.history-incrementa unset MENUSELECT + if [[ $LASTWIDGET == .autocomplete.async.complete.fd-widget ]]; then + zle -R + return 0 + fi + (( KEYS_QUEUED_COUNT || PENDING )) && - return 0 + return region_highlight=() [[ -v functions[_zsh_highlight] ]] && diff --git a/module/.autocomplete.config b/module/.autocomplete.config index b9347eb6..0a24fe90 100644 --- a/module/.autocomplete.config +++ b/module/.autocomplete.config @@ -97,13 +97,6 @@ _autocomplete.config.warnings-format() { reply=( $'%{\e[01;02;39m%}'"No ${${:-$PREFIX$SUFFIX}:+matching }$d found."$'%{\e[0m%}' ) } -zstyle ':completion:*:all-matches' format $'%B%{\e[2m%}Shift-Tab:%b %{\e[2m%}insert %d%b' -zstyle -e ':completion:*:all-matches' hidden _autocomplete.config.all-matches-hidden -_autocomplete.config.all-matches-hidden() { - reply=( all ); [[ $IPREFIX$PREFIX$SUFFIX$ISUFFIX == *${compstate[unambiguous]:#?}* ]] && - reply=( yes ) -} - zstyle ':completion:*:history-lines' format '' zstyle ':completion:*' auto-description '%d' diff --git a/run-tests.zsh b/run-tests.zsh index 192ddd3b..e61d3c04 100755 --- a/run-tests.zsh +++ b/run-tests.zsh @@ -1,4 +1,4 @@ #!/bin/zsh -f -print $OSTYPE =zsh $ZSH_VERSION $ZSH_PATCHLEVEL =clitest +print $VENDOR $OSTYPE =zsh $ZSH_VERSION $ZSH_PATCHLEVEL =clitest local +h -a fpath=( ${0:h}/*(-/) $fpath ) FPATH=$FPATH zsh -f =clitest --list-run --progress dot --prompt '%' -- ${0:h}/.clitest/*.md