From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: completion
Date: Wed, 25 Aug 1999 14:54:16 +0200 (MET DST) [thread overview]
Message-ID: <199908251254.OAA12435@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 25 Aug 1999 10:56:52 +0900
Tanaka Akira wrote:
> In article <199908241043.MAA09262@beta.informatik.hu-berlin.de>,
> Sven Wischnowsky <wischnow@informatik.hu-berlin.de> 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
next reply other threads:[~1999-08-25 12:54 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-25 12:54 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-02-21 9:50 Sven Wischnowsky
1999-10-28 8:12 Sven Wischnowsky
1999-10-28 6:58 Sven Wischnowsky
1999-10-27 8:42 Sven Wischnowsky
1999-10-27 16:39 ` Bart Schaefer
1999-10-27 7:14 Sven Wischnowsky
1999-10-27 21:26 ` Tanaka Akira
1999-10-26 13:17 Sven Wischnowsky
1999-10-26 13:01 Oliver Kiddle
1999-10-26 13:35 ` Zefram
1999-10-26 11:03 Sven Wischnowsky
1999-10-26 17:17 ` Bart Schaefer
1999-10-26 17:22 ` Tanaka Akira
1999-10-26 17:32 ` Tanaka Akira
1999-08-30 9:30 Sven Wischnowsky
1999-08-27 7:03 Sven Wischnowsky
1999-08-27 8:29 ` Tanaka Akira
1999-08-28 6:01 ` Tanaka Akira
1999-08-26 13:52 Sven Wischnowsky
1999-08-26 12:20 Sven Wischnowsky
1999-08-26 13:17 ` Tanaka Akira
1999-08-26 17:56 ` Tanaka Akira
1999-08-25 12:57 Sven Wischnowsky
1999-08-25 8:24 Sven Wischnowsky
1999-08-26 10:54 ` Tanaka Akira
1999-08-24 10:43 Sven Wischnowsky
1999-08-25 1:56 ` Tanaka Akira
1999-08-24 9:12 Sven Wischnowsky
1999-08-24 10:04 ` Tanaka Akira
1999-08-23 13:46 Sven Wischnowsky
1999-08-23 16:16 ` Tanaka Akira
1999-08-24 15:56 ` Tanaka Akira
1999-08-23 12:00 Sven Wischnowsky
1999-08-23 9:32 Sven Wischnowsky
1999-08-23 10:54 ` Tanaka Akira
1999-08-20 12:59 Sven Wischnowsky
1999-08-20 23:22 ` Tanaka Akira
1999-08-21 8:39 ` Tanaka Akira
1999-08-21 17:47 ` Tanaka Akira
1999-08-20 7:42 Sven Wischnowsky
1999-08-19 13:59 Sven Wischnowsky
1999-08-19 10:44 Sven Wischnowsky
1999-08-19 14:38 ` Tanaka Akira
1999-08-24 13:46 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199908251254.OAA12435@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).