From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12775 invoked from network); 25 Aug 1999 12:54:46 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Aug 1999 12:54:46 -0000 Received: (qmail 17388 invoked by alias); 25 Aug 1999 12:54:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7480 Received: (qmail 17381 invoked from network); 25 Aug 1999 12:54:28 -0000 Date: Wed, 25 Aug 1999 14:54:16 +0200 (MET DST) Message-Id: <199908251254.OAA12435@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 25 Aug 1999 10:56:52 +0900 Subject: Re: PATCH: completion Tanaka Akira wrote: > In article <199908241043.MAA09262@beta.informatik.hu-berlin.de>, > Sven Wischnowsky writes: > > > Hey, that's good, I didn't think about adding such files -- we could > > use that to replace `_x_options', too (with `_x_arguments', which > > could probably still be a pattern function). > > Hm. I prefer _xt_arguments instead of _x_arguments because it depends > Xt and there is another popular library --- GTK --- that replace it. Sorry, I wasn't clear. I meant that we should replace the existing `_x_options' with a new `_x_arguments' which adds only a few simple standard X options (like `-display') and then uses "$@" like your _xt_arguments' does (it was that trick that got me excited). > > Now that I've added `Pbmplus', I'd vote for `Completion/X' (and later > > `Completion/Gnu', etc.). We'll have to move some things around when we > > come to the next open release anyway... > > OK. I use Completion/X. However existing files such as _xterm are > not moved now. They should be moved in next interim release. Of course, yes. (And `_colors' and `_cursors' should be renamed to `_x_*' and moved there, too.) Then I tried to make a first step towards a better `_x_font' and found a bug in the completion matching code... Bye Sven diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c --- os/Zle/zle_tricky.c Tue Aug 24 11:13:20 1999 +++ Src/Zle/zle_tricky.c Wed Aug 25 14:25:59 1999 @@ -2297,7 +2297,9 @@ for (mp = ms->matcher; mp; mp = mp->next) { t = 1; if ((lm && lm == mp) || - ((oll == ll || olw == lw) && test && mp->wlen < 0)) + ((oll == ll || olw == lw) && + (test == 1 || (!mp->left && !mp->right)) && + mp->wlen < 0)) /* If we were called recursively, don't use `*' patterns * at the beginning (avoiding infinite recursion). */ continue; @@ -2359,7 +2361,7 @@ savw = tp[-zoff]; tp[-zoff] = '\0'; t = match_str(l - ll, w - lw, - NULL, NULL, 1, 1); + NULL, NULL, 1, 2); tp[-zoff] = savw; } else t = match_str(l + llen + moff, tp + moff, @@ -2410,6 +2412,12 @@ add_match_sub(NULL, NULL, ol, op, ol); add_match_sub(NULL, NULL, llen + alen, lp, llen + alen); + } else if (sfx) { + add_match_str(NULL, NULL, + map, ct + ol + alen, sfx); + add_match_part(mp, l + aoff, wap, alen, + l + loff, llen, op, ol, ol, sfx); + add_match_sub(NULL, NULL, 0, wmp, ct); } else { add_match_str(NULL, NULL, map, ct + ol + alen, sfx); @@ -2590,10 +2598,10 @@ } for (t = matchparts; (tn = t->next); t = tn) { s = (tn->prefix ? tn->prefix : tn->suffix); - if (t->prefix) - t->prefix = s; - else + if (t->suffix) t->suffix = s; + else + t->prefix = s; } t->prefix = t->suffix = NULL; } @@ -4924,13 +4932,15 @@ int n; for (n = 0; m; m = m->next, n++) { - *mp = (Cmlist) zhalloc(sizeof(struct cmlist)); - (*mp)->matcher = m->matcher; - (*mp)->next = NULL; - (*mp)->str = dupstring(m->str); - mp = &((*mp)->next); - addlinknode(matchers, m->matcher); - m->matcher->refc++; + if (m->matcher) { + *mp = (Cmlist) zhalloc(sizeof(struct cmlist)); + (*mp)->matcher = m->matcher; + (*mp)->next = NULL; + (*mp)->str = dupstring(m->str); + mp = &((*mp)->next); + addlinknode(matchers, m->matcher); + m->matcher->refc++; + } } m = mm; compmatcher = 1; diff -u -r oc/Core/_multi_parts Completion/Core/_multi_parts --- oc/Core/_multi_parts Wed Aug 25 10:26:40 1999 +++ Completion/Core/_multi_parts Wed Aug 25 14:50:48 1999 @@ -84,6 +84,8 @@ # No exact match, see how many strings match what's on the line. compadd -O tmp1 - "${(@)matches%%${sep}*}" + tmp2=( "$tmp1[@]" ) + tmp1=( "$tmp2[@]" ) if [[ $#tmp1 -eq 1 ]]; then diff -u -r oc/User/_xterm Completion/User/_xterm --- oc/User/_xterm Wed Aug 25 10:26:49 1999 +++ Completion/User/_xterm Wed Aug 25 10:37:10 1999 @@ -20,8 +20,8 @@ '-cu' '+cu' \ '-dc' '+dc' \ '-e:program: _command_names -e:*::program arguments: _normal' \ - '-fb:bold font:' \ - '-fi:icon font:' \ + '-fb:bold font:_x_font' \ + '-fi:icon font:_x_font' \ '-hc:background color for highlighted text:_colors' \ '-hf' '+hf' \ '-ie' '+ie' \ diff -u -r oc/X/_x_font Completion/X/_x_font --- oc/X/_x_font Wed Aug 25 10:26:50 1999 +++ Completion/X/_x_font Wed Aug 25 14:51:56 1999 @@ -1,3 +1,14 @@ #autoload -_message 'font' +local expl + +# This *has* to be improved some day... + +if (( ! $+_font_cache )); then + typeset -U _font_cache + + _font_cache=( "${(@)^${(@f)$(xlsfonts)}%%--*}--" ) +fi + +_description expl font +compgen -M 'r:|-=* r:|=*' "$expl[@]" "$@" -S '' -k _font_cache diff -u -r oc/X/_xt_arguments Completion/X/_xt_arguments --- oc/X/_xt_arguments Wed Aug 25 10:26:51 1999 +++ Completion/X/_xt_arguments Wed Aug 25 10:30:31 1999 @@ -24,7 +24,6 @@ '+rv' '-rv' '-reverse' \ '+synchronous' '-synchronous' \ '-background:background color:_colors' \ - '-background:background color:_colors' \ '-bd:border color:_colors' \ '-bg:background color:_colors' \ '-bordercolor:border color:_colors' \ -- Sven Wischnowsky wischnow@informatik.hu-berlin.de