From 346825df86466cf151be61b9429ef2c1734e66ea Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 27 Jun 1999 05:33:04 +0000 Subject: zsh-3.1.5-pws-24 --- Src/hist.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Src/hist.c') diff --git a/Src/hist.c b/Src/hist.c index 49dac724c..edf74009e 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -888,9 +888,14 @@ prepnexthistent(int histnum) else { he = hist_ring->down; if (isset(HISTEXPIREDUPSFIRST) && !(he->flags & HIST_DUP)) { + int max_unique_ct = getiparam("SAVEHIST"); do { + if (max_unique_ct-- <= 0) { + he = hist_ring->down; + break; + } he = he->down; - } while (he != hist_ring->down && !(he->flags & HIST_DUP)) ; + } while (he != hist_ring->down && !(he->flags & HIST_DUP)); if (he != hist_ring->down) { he->up->down = he->down; he->down->up = he->up; @@ -989,7 +994,7 @@ hend(void) } #endif /* get rid of pesky \n which we've already nulled out */ - if (!chline[chwords[chwordpos-2]]) + if (chwordpos > 1 && !chline[chwords[chwordpos-2]]) chwordpos -= 2; /* strip superfluous blanks, if desired */ if (isset(HISTREDUCEBLANKS)) -- cgit 1.4.1