about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2001-05-29 20:20:34 +0000
committerClint Adams <clint@users.sourceforge.net>2001-05-29 20:20:34 +0000
commite56c42c9fe218817b8bad84e0a279f0030bc7c7c (patch)
tree5673e66f7154709299ffe3d04b148fb6f8aec6d0 /Src/Zle
parent56528ccb661d4985776234c89355a14093063534 (diff)
downloadzsh-e56c42c9fe218817b8bad84e0a279f0030bc7c7c.tar.gz
zsh-e56c42c9fe218817b8bad84e0a279f0030bc7c7c.tar.xz
zsh-e56c42c9fe218817b8bad84e0a279f0030bc7c7c.zip
145??: repeat last vi history search if search string is blank
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_hist.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index a83ce7334..53481bd80 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -950,7 +950,7 @@ vifetchhistory(char **args)
 
 /* the last vi search */
 
-static char *visrchstr;
+static char *visrchstr, *vipenultsrchstr;
 static int visrchsense;
 
 /**/
@@ -962,8 +962,12 @@ getvisrchstr(void)
     Thingy cmd;
     char *okeymap = curkeymapname;
 
+    if (vipenultsrchstr) {
+	zsfree(vipenultsrchstr);
+    }
+
     if (visrchstr) {
-	zsfree(visrchstr);
+	vipenultsrchstr = visrchstr;
 	visrchstr = NULL;
     }
     clearlist = 1;
@@ -990,6 +994,10 @@ getvisrchstr(void)
 	    	cmd == Th(z_vicmdmode)) {
 	    sbuf[sptr] = 0;
 	    visrchstr = metafy(sbuf + 1, sptr - 1, META_DUP);
+	    if (!strlen(visrchstr)) {
+	        zsfree(visrchstr);
+		visrchstr = vipenultsrchstr;
+	    }
 	    ret = 1;
 	    sptr = 0;
 	} else if(cmd == Th(z_backwarddeletechar) ||