about summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-06-27 05:33:04 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-06-27 05:33:04 +0000
commit346825df86466cf151be61b9429ef2c1734e66ea (patch)
treebd3e1ccd947b47f974c62b4113c5276416de2c9f /Src/hist.c
parenta2159285e80508bb682d90a71270fbddada8bd05 (diff)
downloadzsh-346825df86466cf151be61b9429ef2c1734e66ea.tar.gz
zsh-346825df86466cf151be61b9429ef2c1734e66ea.tar.xz
zsh-346825df86466cf151be61b9429ef2c1734e66ea.zip
zsh-3.1.5-pws-24 zsh-3.1.5-pws-24
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c9
1 files changed, 7 insertions, 2 deletions
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))