summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Terbeck <ft@bewatermyfriend.org>2012-08-08 08:36:25 +0200
committerFrank Terbeck <ft@bewatermyfriend.org>2012-08-08 08:36:25 +0200
commit0b3b271c53e56d13be9277e81e8a1b4f594c2570 (patch)
treed605d99f7d1447ec49bb98678e727d0f0b98bdf3
parent9d57d625a298678555a910fcbb8ed60767d5bc9f (diff)
downloadzsh-0b3b271c53e56d13be9277e81e8a1b4f594c2570.tar.gz
zsh-0b3b271c53e56d13be9277e81e8a1b4f594c2570.zip
Do not use echoti {smkx,rmkx} unconditionally
If a terminal - like the linux kernel's virtual console - is missing those terminfo entries, that will cause annoying output like: zle-line-init:echoti:1: no such terminfo capability: rmkx zle-line-init:echoti:1: no such terminfo capability: smkx for each and every prompt. This tests for the features availability and notes missing ones in a new array `$debian_missing_features'. Signed-off-by: Frank Terbeck <ft@bewatermyfriend.org>
-rw-r--r--debian/zshrc26
1 files changed, 18 insertions, 8 deletions
diff --git a/debian/zshrc b/debian/zshrc
index 4a0bfb44f..716bce629 100644
--- a/debian/zshrc
+++ b/debian/zshrc
@@ -8,6 +8,9 @@
READNULLCMD=${PAGER:-/usr/bin/pager}
+# An array to note missing features to ease diagnosis in case of problems.
+typeset -ga debian_missing_features
+
if [[ -z "$DEBIAN_PREVENT_KEYBOARD_CHANGES" ]] &&
[[ "$TERM" != 'emacs' ]]
then
@@ -63,14 +66,21 @@ then
# Make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
- function zle-line-init () {
- echoti smkx
- }
- function zle-line-finish () {
- echoti rmkx
- }
- zle -N zle-line-init
- zle -N zle-line-finish
+ 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
+ else
+ for i in {s,r}mkx; do
+ (( ${+terminfo[$i]} )) || debian_missing_features+=($i)
+ done
+ unset i
+ fi
unfunction bind2maps