Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug in vi-mode search



On Thu, 12 Mar 2009 09:55:30 -0700
Danek Duvall <duvall@xxxxxxxxxxxxxx> wrote:
>     When using vi keybindings (set -o vi) history search is initiated by
>     ESC-/. The searching appears to be broken:
> 
>     The initial history line returned is correct but subsequent entries (by
>     repeatedly pressing '/') returned don't have the search string in them
>     and appear to simply be sequential entries from the history file.

Yes, this looks like a simple screwup when changing the code.

I've also noticed I unintentionally removed the "_" that appears where
the next character is to be inserted.

See if this is better.

(Diff against the files in the Git repository Wayne set up while we wait
for CVS to recover, at which point it will be committed.)

--- ../zsh-git/zsh/Src/Zle/zle_hist.c	2009-03-12 20:34:56.000000000 +0000
+++ Src/Zle/zle_hist.c	2009-03-12 20:18:29.000000000 +0000
@@ -1742,7 +1742,7 @@
     selectkeymap("main", 1);
     while (sptr) {
 	sbuf[sptr] = '_';
-	sbuf[sptr] = '\0';
+	sbuf[sptr+1] = '\0';
 	zrefresh();
 	if (!(cmd = getkeycmd()) || cmd == Th(z_sendbreak)) {
 	    ret = 0;
@@ -1760,6 +1760,10 @@
 	    	cmd == Th(z_vicmdmode)) {
 	    sbuf[sptr] = ZWC('\0');
 	    visrchstr = ztrdup(sbuf+1);
+	    if (!strlen(visrchstr)) {
+	        zsfree(visrchstr);
+		visrchstr = ztrdup(vipenultsrchstr);
+	    }
 	    ret = 1;
 	    sptr = 0;
 	} else if(cmd == Th(z_backwarddeletechar) ||


-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author