about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Completion/Core/_multi_parts2
-rw-r--r--Completion/User/_xterm4
-rw-r--r--Completion/X/_x_font13
-rw-r--r--Completion/X/_xt_arguments1
-rw-r--r--Src/Zle/zle_tricky.c34
5 files changed, 38 insertions, 16 deletions
diff --git a/Completion/Core/_multi_parts b/Completion/Core/_multi_parts
index 392277f94..d51130391 100644
--- a/Completion/Core/_multi_parts
+++ b/Completion/Core/_multi_parts
@@ -84,6 +84,8 @@ while true; do
     # 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 --git a/Completion/User/_xterm b/Completion/User/_xterm
index 460921193..379e5a46d 100644
--- a/Completion/User/_xterm
+++ b/Completion/User/_xterm
@@ -20,8 +20,8 @@ _xt_arguments \
   '-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 --git a/Completion/X/_x_font b/Completion/X/_x_font
index e0acb4014..d4f16f33c 100644
--- a/Completion/X/_x_font
+++ b/Completion/X/_x_font
@@ -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 --git a/Completion/X/_xt_arguments b/Completion/X/_xt_arguments
index 02f11e226..6324c27e0 100644
--- a/Completion/X/_xt_arguments
+++ b/Completion/X/_xt_arguments
@@ -24,7 +24,6 @@ _arguments \
   '+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' \
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 2309fe27f..f3e7edf03 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2297,7 +2297,9 @@ match_str(char *l, char *w, int *bp, int *rwlp, int sfx, int test)
 	    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 @@ match_str(char *l, char *w, int *bp, int *rwlp, int sfx, int test)
 				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 @@ match_str(char *l, char *w, int *bp, int *rwlp, int sfx, int test)
 			    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 @@ match_str(char *l, char *w, int *bp, int *rwlp, int sfx, int test)
 	}
 	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 @@ makecomplist(char *s, int incmd, int lst)
 	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;