summaryrefslogtreecommitdiffstats
path: root/Src/Zle/zle_params.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-03-22 16:22:13 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-03-22 16:22:13 +0000
commit08dec290d4d6558f95df9e22daf3a9940547442a (patch)
tree9eb814910f2b5c396d2cd82928e5e7ce14f1984d /Src/Zle/zle_params.c
parentFAQ update (diff)
downloadzsh-08dec290d4d6558f95df9e22daf3a9940547442a.tar
zsh-08dec290d4d6558f95df9e22daf3a9940547442a.tar.gz
zsh-08dec290d4d6558f95df9e22daf3a9940547442a.tar.bz2
zsh-08dec290d4d6558f95df9e22daf3a9940547442a.tar.lz
zsh-08dec290d4d6558f95df9e22daf3a9940547442a.tar.xz
zsh-08dec290d4d6558f95df9e22daf3a9940547442a.tar.zst
zsh-08dec290d4d6558f95df9e22daf3a9940547442a.zip
Fix ZLE access to pushed history line
Diffstat (limited to 'Src/Zle/zle_params.c')
-rw-r--r--Src/Zle/zle_params.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index f384753e2..2883c0fbd 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -334,8 +334,19 @@ get_rbuffer(UNUSED(Param pm))
static char *
get_prebuffer(UNUSED(Param pm))
{
- if (chline)
+ /*
+ * Use the editing current history line, not necessarily the
+ * history line that's currently in the history mechanism
+ * since our line may have been stacked.
+ */
+ if (zle_chline) {
+ /* zle_chline was NULL terminated when pushed onto the stack */
+ return dupstring(zle_chline);
+ }
+ if (chline) {
+ /* hptr is valid */
return dupstrpfx(chline, hptr - chline);
+ }
return dupstring("");
}