From ff0cafa14db5b728f823ee486ec1bf5a9d2725eb Mon Sep 17 00:00:00 2001 From: Felix Dreissig Date: Sun, 14 Oct 2012 00:07:47 +0200 Subject: [PATCH] Make sure the terminal is always in application mode when zle is active. --- lib/key-bindings.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 8168c8d9..a57b0412 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -2,6 +2,19 @@ # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets +# Make sure that the terminal is in application mode when zle is active, since +# only then values from $terminfo are valid +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init() { + echoti smkx + } + function zle-line-finish() { + echoti rmkx + } + zle -N zle-line-init + zle -N zle-line-finish +fi + bindkey -e # Use emacs key bindings bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark