about summary refs log tree commit diff
path: root/Src/Zle/zle_hist.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_hist.c')
-rw-r--r--Src/Zle/zle_hist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 5af482f9e..91d2d1016 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1045,6 +1045,7 @@ doisearch(char **args, int dir)
 		free(last_line);
 	    last_line = ztrdup(zt.text);
 
+	    sbuf[sbptr] = '\0';
 	    for (;;) {
 		char *t;
 
@@ -1076,7 +1077,6 @@ doisearch(char **args, int dir)
 		 * First search for a(nother) match within the
 		 * current line, unless we've been told to skip it.
 		 */
-		sbuf[sbptr] = '\0';
 		if (!skip_line && ((sbuf[0] == '^') ?
 				   (t = (zlinecmp(zt.text, sbuf + 1) < sens
 					 ? zt.text : NULL)) :