summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-05-11 18:37:34 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-05-11 18:37:34 +0000
commit4bed4f9d0f6429399b82a83d8636d1c8b2810436 (patch)
treee13b9b99414c842f90f5dc4f56e5e5db56e44e41
parent001e8ca70e90f574c90c00c5dad41221db248c1b (diff)
downloadzsh-4bed4f9d0f6429399b82a83d8636d1c8b2810436.tar.gz
zsh-4bed4f9d0f6429399b82a83d8636d1c8b2810436.tar.xz
zsh-4bed4f9d0f6429399b82a83d8636d1c8b2810436.zip
24994: fix problem with up/down-line-or-search, perhaps
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_hist.c12
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index bb66ce39a..b4bb526d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-05-11  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 24994: Src/Zle/zle_hist.c: Fix problem with
+	up/down-line-or-search comparison, perhaps.
+
 	* 24990: Stephane Chazelas: Functions/Misc/zmv: fix
 	various little quirks in zmv.
 
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 54c103f60..85c149929 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -111,7 +111,7 @@ zlinecmp(const char *histp, const char *inputp)
     mbstate_t hstate, istate;
 #endif
 
-    while (*hptr == *iptr) {
+    while (*iptr && *hptr == *iptr) {
 	hptr++;
 	iptr++;
     }
@@ -470,13 +470,15 @@ historysearchbackward(char **args)
     if (!(he = quietgethist(histline)))
 	return 1;
 
+    metafy_line();
     while ((he = movehistent(he, -1, hist_skip_flags))) {
 	if (isset(HISTFINDNODUPS) && he->node.flags & HIST_DUP)
 	    continue;
 	zt = GETZLETEXT(he);
 	if (zlinecmp(zt, str) < 0 &&
-	    (*args || strcmp(zt, str) != 0)) {
+	    (*args || strcmp(zt, zlemetaline) != 0)) {
 	    if (--n <= 0) {
+		unmetafy_line();
 		zle_setline(he);
 		srch_hl = histline;
 		srch_cs = zlecs;
@@ -484,6 +486,7 @@ historysearchbackward(char **args)
 	    }
 	}
     }
+    unmetafy_line();
     return 1;
 }
 
@@ -524,13 +527,15 @@ historysearchforward(char **args)
     if (!(he = quietgethist(histline)))
 	return 1;
 
+    metafy_line();
     while ((he = movehistent(he, 1, hist_skip_flags))) {
 	if (isset(HISTFINDNODUPS) && he->node.flags & HIST_DUP)
 	    continue;
 	zt = GETZLETEXT(he);
 	if (zlinecmp(zt, str) < (he->histnum == curhist) &&
-	    (*args || strcmp(zt, str) != 0)) {
+	    (*args || strcmp(zt, zlemetaline) != 0)) {
 	    if (--n <= 0) {
+		unmetafy_line();
 		zle_setline(he);
 		srch_hl = histline;
 		srch_cs = zlecs;
@@ -538,6 +543,7 @@ historysearchforward(char **args)
 	    }
 	}
     }
+    unmetafy_line();
     return 1;
 }