--- sh.hist.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- sh.hist.c +++ sh.hist.c 2023-07-21 12:21:55.518480015 +0000 @@ -64,7 +64,7 @@ static void hfree (struct Hist *); /* #define DEBUG_HIST 1 */ -static const int fastMergeErase = 1; +static int fastMergeErase = 1; static unsigned histCount = 0; /* number elements on history list */ static int histlen = 0; static struct Hist *histTail = NULL; /* last element on history list */ @@ -1321,6 +1321,7 @@ rechist(Char *xfname, int ref) } if (merge) { + fastMergeErase = 0; /* Was true, now false to merge even with full history list */ jmp_buf_t osetexit; if (lock) { #ifndef WINNT_NATIVE @@ -1393,7 +1394,7 @@ loadhist(Char *fname, int mflg) /* During history merging (enthist sees mflg set), we disable management of * Hnum and Href (because fastMergeErase is true). So now reset all the * values based on the final ordering of the history list. */ - if (mflg) { + if (mflg && fastMergeErase) { int n = eventno; struct Hist *hp = &Histlist; while ((hp = hp->Hnext))