From 8564319c233b615c6b2500f166cfdcc0e8d1185c Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 7 Sep 2012 17:59:35 +0200 Subject: [PATCH] Workaround incompatibilities with the keyboard setup of some vendors Some vendors, like Debian (and therefore Ubuntu), enable smkx terminal mode in the zle-line-init widget and turn it back off in zle-line-finish. While that is the right thing to do, because it makes sure the values from $terminfo are valid. However, we are currently incompatible with that. And it is a lot of work to get it right for every binding we have, because we do have some, that are not available in the vast majority of terminfo entries (like -). Signed-off-by: Frank Terbeck --- etc/zsh/zshrc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 4f0da7e..4e7ef09 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -585,6 +585,22 @@ watch=(notme root) # automatically remove duplicates from these arrays typeset -U path cdpath fpath manpath +# Remove zle-line-{init,finish} if it looks like it turns smkx. This would be +# better fixed by working with those modes too, but we use way too many +# hardcoded bindings for now. +function remove_widget () { + local name=$1 + local cap=$2 + if (( ${+functions[$name]} )) && [[ ${functions[$name]} == *${cap}* ]]; then + local w=${widgets[$name]} + zle -D $name + [[ $w == user:* ]] && unfunction ${w#*:} + fi +} +remove_widget zle-line-init smkx +remove_widget zle-line-finish rmkx +unfunction remove_widget + # keybindings if [[ "$TERM" != emacs ]] ; then [[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char -- 2.1.4