From 16ff79a885f28bc9509901dd5d8ce9ccc9960811 Mon Sep 17 00:00:00 2001 From: Han Pingtian Date: Sat, 5 Oct 2013 20:50:10 +0800 Subject: 31789: Save history for INCAPPENDHISTORY later. This improves the timing recorded in the history. --- Src/hist.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Src/hist.c') diff --git a/Src/hist.c b/Src/hist.c index 3d6068e51..1961d8350 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -871,6 +871,8 @@ unlinkcurline(void) mod_export void hbegin(int dohist) { + char *hf; + isfirstln = isfirstch = 1; errflag = histdone = 0; if (!dohist) @@ -924,6 +926,10 @@ hbegin(int dohist) defev = addhistnum(curhist, -1, HIST_FOREIGN); } else histactive = HA_ACTIVE | HA_NOINC; + + hf = getsparam("HISTFILE"); + if (isset(INCAPPENDHISTORY)) + savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); } /**/ @@ -1328,7 +1334,7 @@ hend(Eprog prog) chline = hptr = NULL; chwords = NULL; histactive = 0; - if (isset(SHAREHISTORY)? histfileIsLocked() : isset(INCAPPENDHISTORY)) + if (isset(SHAREHISTORY) && histfileIsLocked()) savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); unlockhistfile(hf); /* It's OK to call this even if we aren't locked */ /* -- cgit 1.4.1