diff options
author | Robby Russell <robby@planetargon.com> | 2012-12-04 06:34:02 -0800 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2012-12-04 06:34:02 -0800 |
commit | 3199d2ed8d70dc45911f34dd7c2ec4b702db3b28 (patch) | |
tree | 3f883befc316cb35a6d02562f299adca6c0f90c3 /plugins/vi-mode | |
parent | 43ca5d8cbee9c75df8ada9bb2fb3fd4e4267426f (diff) | |
parent | 4e513d72b9542b7b5079451e3380b4a98b0b7b56 (diff) | |
download | zsh-3199d2ed8d70dc45911f34dd7c2ec4b702db3b28.tar.gz zsh-3199d2ed8d70dc45911f34dd7c2ec4b702db3b28.tar.bz2 zsh-3199d2ed8d70dc45911f34dd7c2ec4b702db3b28.zip |
Merge pull request #1387 from jimhester/vi-mode-patch
Fixes for vi-mode terminal overwriting bugs
Diffstat (limited to 'plugins/vi-mode')
-rw-r--r-- | plugins/vi-mode/vi-mode.plugin.zsh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index c47ab7211..f91be70e4 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -1,8 +1,26 @@ -function zle-line-init zle-keymap-select { +# Ensures that $terminfo values are valid and updates editor information when +# the keymap changes. +function zle-keymap-select zle-line-init zle-line-finish { + # The terminal must be in application mode when ZLE is active for $terminfo + # values to be valid. + if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then + case "$0" in + (zle-line-init) + # Enable terminal application mode. + echoti smkx + ;; + (zle-line-finish) + # Disable terminal application mode. + echoti rmkx + ;; + esac + fi zle reset-prompt + zle -R } zle -N zle-line-init +zle -N zle-line-finish zle -N zle-keymap-select bindkey -v |