ff0cafa14db5b728f823ee486ec1bf5a9d2725eb

Author
Felix Dreissig <f30@f30.me>
Committer
Felix Dreissig <f30@f30.me>
Date

Message

Make sure the terminal is always in application mode when zle is active.

Diff

 1diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh
 2index 8168c8d90e260f700fca8e9def70e70280f53cf7..a57b041222c5f5d8ce74618d8218bf646622dbc3 100644
 3--- a/lib/key-bindings.zsh
 4+++ b/lib/key-bindings.zsh
 5@@ -2,6 +2,19 @@
 6 # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins
 7 # http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets
 8 
 9+# Make sure that the terminal is in application mode when zle is active, since
10+# only then values from $terminfo are valid
11+if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
12+  function zle-line-init() {
13+    echoti smkx
14+  }
15+  function zle-line-finish() {
16+    echoti rmkx
17+  }
18+  zle -N zle-line-init
19+  zle -N zle-line-finish
20+fi
21+
22 bindkey -e                                          # Use emacs key bindings
23 
24 bindkey '\ew' kill-region                           # [Esc-w] - Kill from the cursor to the mark