[input] Use custom expand-or-complete in zsh < 5.3

as `expand-or-complete-with-redisplay` was added to fix an issue
reported with zsh 5.2 when completing with <Tab><Tab><Ctrl-C>. See #85.

Fixes #134
This commit is contained in:
Eric Nielsen 2018-04-04 18:52:22 -05:00
parent 56b61e211d
commit 4240140fb3
1 changed files with 10 additions and 8 deletions

View File

@ -102,14 +102,16 @@ if [[ -n "${key_info[BackTab]}" ]]; then
bindkey "${key_info[BackTab]}" reverse-menu-complete bindkey "${key_info[BackTab]}" reverse-menu-complete
fi fi
# Redisplay after completing, and avoid blank prompt after <Tab><Tab><Ctrl-C> autoload -Uz is-at-least && if ! is-at-least 5.3; then
expand-or-complete-with-redisplay() { # Redisplay after completing, and avoid blank prompt after <Tab><Tab><Ctrl-C>
print -n '...' expand-or-complete-with-redisplay() {
zle expand-or-complete print -Pn '...'
zle redisplay zle expand-or-complete
} zle redisplay
zle -N expand-or-complete-with-redisplay }
bindkey "${key_info[Control]}I" expand-or-complete-with-redisplay zle -N expand-or-complete-with-redisplay
bindkey "${key_info[Control]}I" expand-or-complete-with-redisplay
fi
# Put into application mode and validate ${terminfo} # Put into application mode and validate ${terminfo}
zle-line-init() { zle-line-init() {