about summary refs log tree commit diff
path: root/Completion/X
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2012-11-16 23:00:18 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2012-11-16 23:00:18 +0000
commit1f359ae462dc5b19d04706e88195297eb2777d3f (patch)
tree3d542cc718306fd69a7de6809ce4557601072eb5 /Completion/X
parent7c56d771840a9f335b2e21290c8cbf714264bc66 (diff)
downloadzsh-1f359ae462dc5b19d04706e88195297eb2777d3f.tar.gz
zsh-1f359ae462dc5b19d04706e88195297eb2777d3f.tar.xz
zsh-1f359ae462dc5b19d04706e88195297eb2777d3f.zip
30801: fix font completion for newer fontconfig & update urxvt completion
Diffstat (limited to 'Completion/X')
-rw-r--r--Completion/X/Command/_urxvt83
-rw-r--r--Completion/X/Type/_xft_fonts2
2 files changed, 59 insertions, 26 deletions
diff --git a/Completion/X/Command/_urxvt b/Completion/X/Command/_urxvt
index af227552a..b7ea06be5 100644
--- a/Completion/X/Command/_urxvt
+++ b/Completion/X/Command/_urxvt
@@ -1,39 +1,72 @@
-#compdef urxvt
+#compdef rxvt urxvt urxvtc
+
+local curcontext="$curcontext" state line expl
+local -a suf long_args
+typeset -A opt_args
+typeset -U extensions
+
+[[ -prefix -- ]] || zstyle -T ":completion:${curcontext}:options" prefix-needed &&
+  : ${(A)long_args:=${${${${${${${(M)${(f)"$(urxvt --help 2>&1)"}:#  *:*}/  /--}// /}/fontname/fontname:->fonts}/:color/:color:_x_color}/boolean/boolean:(true false)}/:(searchpath|file)/:path:_files}}
 
 _x_arguments \
-  -+{rv,ls,j,ptab,sb,sr,st,si,sk,sw,ip,ipf,ut,vb,tcw,insecure,uc,bc,pb,bl,ssc,ssr} \
-  '-tn:terminal type:' \
+  -+{rv,ls,j,ss,ptab,sb,sr,st,si,sk,sw,ip,tr,ut,vb,tcw,insecure,uc,bc,pb,is,override-redirect,hold,bl,sbg,ssc,ssr} \
+  '-tn[specify value of TERM]:terminal type:_terminals' \
   '-C[intercept console messages]' \
   '-iconic[start iconic]' \
-  '-sbt[scroll bar thickness]:pixels:' \
+  '-cd[start shell in specific directory]:directory:_files -/' \
+  '-sbt[scroll bar thickness]:pixels' \
   '-tint[tint color]:color:_x_color' \
-  '-fade[make colors darker when losing focus]:percentage:' \
-  '-sh[shade background when tinting]:percentage:' \
-  '-bg:background color:_x_color' \
-  '-fg:foreground color:_x_color' \
-  '-cr:cursor color:_x_color' \
-  '-pr:pointer color:_x_color' \
-  '-pr2:pointer background color:_x_color' \
-  '-bd:border color:_x_color' \
+  '-fade[make colors darker when losing focus]:percentage' \
+  '-fadecolor[specify target color for off-focus fading]:color:_x_color' \
+  '-sh[shade background when tinting]:percentage' \
+  '-bg[background color]:color:_x_color' \
+  '-fg[foreground color]:color:_x_color' \
+  '-hc[highlight color]:color:_x_color' \
+  '-cr[cursor color]:color:_x_color' \
+  '-pr[pointer color]:color:_x_color' \
+  '-pr2[pointer background color]:color:_x_color' \
+  '-bd[border color]:color:_x_color' \
   '-pixmap:pixmap:_files' \
-  '-fn:normal font:_x_font' \
-  '-fb:bold font:_x_font' \
-  '-fi:italic font:_x_font' \
-  '-fbi:bold italic font:_x_font' \
+  '-icon[specify icon image]:image file:_files' \
+  '-fn:normal font:->fonts' \
+  '-fb:bold font:->fonts' \
+  '-fi:italic font:->fonts' \
+  '-fbi:bold italic font:->fonts' \
   '-im:input method:(SCIM)' \
+  '-pe[enable perl extension]:perl extension:->extensions' \
   '-pt:input style:(OverTheSpot OffTheSpot Root)' \
   '-imlocale:locale input method:_locales' \
   '-imfont:fontset for styles OverTheSpot and OffTheSpot:_x_font' \
-  '-name:client instance, icon, and title strings:' \
-  '-title:title name for window:' \
-  '-n:icon name for window:' \
-  '-sl:save lines:' \
+  '-name:client instance, icon, and title strings' \
+  '(-T -title)'{-T,-title}':title name for window' \
+  '-n:icon name for window' \
+  '-sl:save lines' \
   '-embed:window id to embed terminal in:_x_window' \
-  '-pty-fd:file descriptor of pty to use:' \
-  '-w:external border in pixels:' \
-  '-b:internal border in pixels:' \
-  '-lsp:number of extra pixels between rows:' \
+  '-pty-fd:file descriptor of pty to use' \
+  '-w:external border in pixels' \
+  '-b:internal border in pixels' \
+  '-lsp:number of extra pixels between rows' \
+  '-letsp:letter spacing adjustment' \
   '-mod:meta modifier:_x_modifier' \
   '-e:program: _command_names -e:*::program arguments: _normal' \
   '-help[print help]' \
-  '--help[list long options]'
+  '--help[list long options]' $long_args && ret=0
+
+case $state in
+  fonts)
+    if compset -P xft:; then
+      _xft_fonts && ret=0
+    else
+      _x_font && ret=0
+    fi
+  ;;
+  extensions)
+    compset -S ',*' || suf=( -qS , )
+    compset -P '*,'; compset -P -
+    extensions=( {$commands[urxvt]:h:h,/usr,/usr/local}/lib{,64}/urxvt/perl(N) )
+    _wanted extensions expl 'perl extension' compadd $suf[@] default \
+        $extensions/*(:t) && ret=0
+  ;;
+esac
+
+return ret
diff --git a/Completion/X/Type/_xft_fonts b/Completion/X/Type/_xft_fonts
index 0d5f56fe5..535b9b5ae 100644
--- a/Completion/X/Type/_xft_fonts
+++ b/Completion/X/Type/_xft_fonts
@@ -37,7 +37,7 @@ elif compset -P '*[^\\]-'; then
   _message -e size 'point size' && ret=0
 else
   _wanted fonts expl font compadd "$suf[@]" \
-      ${${(f)"$(_call_program fonts fc-list 2>/dev/null)"//,/$'\n'}%%:*} && ret=0
+      ${(us:,:)$(_call_program fonts fc-list -f '%\{family\},' 2>/dev/null)} && ret=0
 fi
 
 return ret