From 9bf7fb75c55d3ac23c47d5af0d96f4e1af727222 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sat, 21 Oct 2000 03:15:36 +0000 Subject: Fix "vared -h" in shell scripts. --- Src/Zle/zle_main.c | 2 +- Src/hist.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Src') diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index e02ea14b8..675dda63e 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -903,7 +903,7 @@ bin_vared(char *name, char **args, char *ops, int func) if (ops['e']) isfirstln = 1; if (ops['h']) - hbegin(1); + hbegin(2); t = (char *) zleread(p1, p2, ops['h'] ? ZLRF_HISTORY : 0); if (ops['h']) hend(NULL); diff --git a/Src/hist.c b/Src/hist.c index 4d803c0bd..9149d479b 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -736,7 +736,12 @@ hbegin(int dohist) { isfirstln = isfirstch = 1; errflag = histdone = 0; - stophist = (!dohist || !interact || unset(SHINSTDIN)) ? 2 : 0; + if (!dohist) + stophist = 2; + else if (dohist != 2) + stophist = (!interact || unset(SHINSTDIN)) ? 2 : 0; + else + stophist = 0; if (stophist == 2 || (inbufflags & INP_ALIAS)) { chline = hptr = NULL; hlinesz = 0; @@ -764,7 +769,7 @@ hbegin(int dohist) if (hist_ring && !hist_ring->ftim) hist_ring->ftim = time(NULL); - if (interact && isset(SHINSTDIN) && !strin) { + if ((dohist == 2 || (interact && isset(SHINSTDIN))) && !strin) { histactive = HA_ACTIVE; attachtty(mypgrp); linkcurline(); -- cgit 1.4.1