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

PATCH: make get-line widget update history number



After accept-line-and-down-history, a get-line does not set the history
number (HISTNO).

I override history-incremental-search-backward to use
narrow-to-region when invoked on a non-empty buffer. This is useful for
retrieving history into, e.g the middle of a for loop.

With this change, if the recursive-edit was finished with an
accept-line-and-down-history, it can now call zle get-line, loop
back around and subsequent accept-line-and-down-historys will insert
subsequent history lines. This is probably also possible by manually
editing PRE/POSTDISPLAY and HISTNO but it's much easier this way.

I'm trying to think of things that this might possibly break but I
can't. I don't think I've ever used get-line before. Anyone else see a
problem?

diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index bd5bc36..44b39d1 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -890,6 +890,10 @@ zgetline(UNUSED(char **args))
 	free(s);
 	free(lineadd);
 	clearlist = 1;
+	if (stackhist != -1) {
+	    histline = stackhist;
+	    stackhist = -1;
+	}
     }
     return 0;
 }



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