* 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
* Re: PATCH: make get-line widget update history number
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
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2014-03-01 2:30 UTC (permalink / raw)
To: Zsh workers
On Mar 1, 1:20am, Oliver Kiddle wrote:
}
} 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?
No; this looks like something that always should have been there.
The only possible gotcha I can think of would be if a widget invoked
from inside recursive-edit did something with "fc -p ..." without -a,
or "fc -P", but I haven't really traced through what's happening with
stackhist there.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: make get-line widget update history number
2014-03-01 2:30 ` Bart Schaefer
@ 2014-03-01 18:57 ` Peter Stephenson
0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2014-03-01 18:57 UTC (permalink / raw)
To: Zsh workers
On Fri, 28 Feb 2014 18:30:37 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Mar 1, 1:20am, Oliver Kiddle wrote:
> }
> } 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?
>
> No; this looks like something that always should have been there.
...and given this appears to be a fairly obscure feature, "suck it and
see" seems to be about the best way of proceeding anyway.
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
^ 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).