about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-18 20:04:34 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-18 20:04:34 +0000
commitde9af0062cc69945d90e40d3e0e8ca310f9346ad (patch)
tree0b9a3689401d21b21c515b1e5b3431f076c6817d
parentfd9875a312b0d803da28ce0decf4f9b7b7cd6ddc (diff)
downloadzsh-de9af0062cc69945d90e40d3e0e8ca310f9346ad.tar.gz
zsh-de9af0062cc69945d90e40d3e0e8ca310f9346ad.tar.xz
zsh-de9af0062cc69945d90e40d3e0e8ca310f9346ad.zip
zsh-workers/7929
-rw-r--r--Src/Zle/zle_tricky.c5
-rw-r--r--Src/hist.c11
2 files changed, 12 insertions, 4 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index b95fe8aa6..e44f684c2 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -6717,8 +6717,8 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	/* We have a pattern to take things from the history. */
 	Patprog pprogc = NULL;
 	char *e, *h, hpatsav;
-	Histent he;
 	int i = addhistnum(curhist,-1,HIST_FOREIGN), n = cc->hnum;
+	Histent he = quietgethistent(i, GETHIST_UPWARD);
 
 	/* Parse the pattern, if it isn't the null string. */
 	if (*(cc->hpat)) {
@@ -6732,7 +6732,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	    n = -1;
 
 	/* Now search the history. */
-	while (n-- && (he = quietgethist(i--))) {
+	while (n-- && he) {
 	    int iwords;
 	    for (iwords = 0; iwords < he->nwords; iwords++) {
 		h = he->text + he->words[iwords*2];
@@ -6748,6 +6748,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 		if (hpatsav)
 		    *e = hpatsav;
 	    }
+	    he = up_histent(he);
 	}
     }
     if ((t = cc->mask & (CC_ARRAYS | CC_INTVARS | CC_ENVVARS | CC_SCALARS |
diff --git a/Src/hist.c b/Src/hist.c
index a78c403f1..fcd5d877a 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1435,14 +1435,21 @@ convamps(char *out, char *in, int inlen)
 
 /**/
 Histent
-quietgethist(int ev)
+quietgethistent(int ev, int nearmatch)
 {
     if (ev == curhist && (histactive & HA_ACTIVE)) {
 	curline.text = chline;
 	curline.nwords = chwordpos/2;
 	curline.words = chwords;
     }
-    return gethistent(ev, GETHIST_EXACT);
+    return gethistent(ev, nearmatch);
+}
+
+/**/
+Histent
+quietgethist(int ev)
+{
+    return quietgethistent(ev, GETHIST_EXACT);
 }
 
 /**/