zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: make get-line widget update history number
@ 2014-03-01  0:20 Oliver Kiddle
  2014-03-01  2:30 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2014-03-01  0:20 UTC (permalink / raw)
  To: Zsh workers

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;
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-01 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-01  0:20 PATCH: make get-line widget update history number Oliver Kiddle
2014-03-01  2:30 ` Bart Schaefer
2014-03-01 18:57   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).