Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: X font completion is buggy

Vincent Lefevre wrote:
> zira:~> xterm -fn fixed--

Trying to fix this without understanding what _x_font is doing would lead me
to the following patch. 
But this will still result in stuff like:
Warning: Cannot convert string "-adobe-courier-bold-o-normal--" to type FontStruct

Anyone know what might be special about two dashes or was it just an
attempt to reduce the number of matches?. It is also passing -S ''
to compadd which backs up that theory: it only makes sense with the
incomplete fonts. The line is little changed since it was added in 7480
(Aug 1999).

These days, xft fonts tend to be more useful so you might instead want to try
the -fa option to xterm. e.g: xterm -fa Inconsolata


diff --git a/Completion/X/Type/_x_font b/Completion/X/Type/_x_font
index a363b27..368b6a6 100644
--- a/Completion/X/Type/_x_font
+++ b/Completion/X/Type/_x_font
@@ -9,7 +9,7 @@ _tags fonts || return 1
 if (( ! $+_font_cache )); then
   typeset -gU _font_cache
- _font_cache=( "${(@)^${(@f)$(_call_program fonts xlsfonts 2> /dev/null)}%%--*}--" )
+ _font_cache=( ${${(f)"$(_call_program fonts xlsfonts)"}/--*/--} )
 _wanted fonts expl font \

Messages sorted by: Reverse Date, Date, Thread, Author