about summary refs log tree commit diff
path: root/Src/Zle/zle_hist.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-06-08 09:25:39 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-06-08 09:25:39 +0000
commit805381040dd69dd02b78423d2d71913b33f3cc33 (patch)
tree1fa89ee643e8e577a2f79e76e3d6cafc93256ca2 /Src/Zle/zle_hist.c
parentf42e3fa8e6152e145251e8f16f4c61c23dec1f59 (diff)
downloadzsh-805381040dd69dd02b78423d2d71913b33f3cc33.tar.gz
zsh-805381040dd69dd02b78423d2d71913b33f3cc33.tar.xz
zsh-805381040dd69dd02b78423d2d71913b33f3cc33.zip
zsh-3.1.5-pws-21 zsh-3.1.5-pws-21
Diffstat (limited to 'Src/Zle/zle_hist.c')
-rw-r--r--Src/Zle/zle_hist.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index d2b9a3233..2fc55e98c 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -76,7 +76,8 @@ forget_edits(void)
 void
 uphistory(void)
 {
-    if (!zle_goto_hist(histline, -zmult) && isset(HISTBEEP))
+    int nodups = isset(HISTIGNOREDUPS);
+    if (!zle_goto_hist(histline, -zmult, nodups) && isset(HISTBEEP))
 	feep();
 }
 
@@ -267,7 +268,8 @@ acceptlineanddownhistory(void)
 void
 downhistory(void)
 {
-    if (!zle_goto_hist(histline, zmult) && isset(HISTBEEP))
+    int nodups = isset(HISTIGNOREDUPS);
+    if (!zle_goto_hist(histline, zmult, nodups) && isset(HISTBEEP))
 	feep();
 }
 
@@ -370,7 +372,7 @@ beginningofbufferorhistory(void)
 void
 beginningofhistory(void)
 {
-    if (!zle_goto_hist(firsthist(), 0) && isset(HISTBEEP))
+    if (!zle_goto_hist(firsthist(), 0, 0) && isset(HISTBEEP))
 	feep();
 }
 
@@ -388,7 +390,7 @@ endofbufferorhistory(void)
 void
 endofhistory(void)
 {
-    zle_goto_hist(curhist, 0);
+    zle_goto_hist(curhist, 0, 0);
 }
 
 /**/
@@ -472,9 +474,14 @@ setlocalhistory(void)
 
 /**/
 int
-zle_goto_hist(int ev, int n)
+zle_goto_hist(int ev, int n, int skipdups)
 {
     Histent he = movehistent(quietgethist(ev), n, hist_skip_flags);
+    if (skipdups && n) {
+	n = n < 0? -1 : 1;
+	while (he && !metadiffer(ZLETEXT(he), (char *) line, ll))
+	    he = movehistent(he, n, hist_skip_flags);
+    }
     if (!he)
 	return 0;
     zle_setline(he);
@@ -906,7 +913,7 @@ vifetchhistory(void)
 	    return;
 	}
     }
-    if (!zle_goto_hist((zmod.flags & MOD_MULT) ? zmult : curhist, 0) &&
+    if (!zle_goto_hist((zmod.flags & MOD_MULT) ? zmult : curhist, 0, 0) &&
 	isset(HISTBEEP))
 	feep();
 }