Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: pws-20: minor history changes
- X-seq: zsh-workers 6430
- From: Wayne Davison <wayne@xxxxxxxxx>
- To: "ZSH workers mailing list" <zsh-workers@xxxxxxxxxxxxxx>
- Subject: PATCH: pws-20: minor history changes
- Date: Tue, 01 Jun 1999 23:59:31 -0700
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Here's a patch I've been meaning to send in for a little while now.
It is just two minor tweaks that tidy up my recent history changes.
The first change handles a minor problem that occurs when we're
viewing local history lines only. If I have HIST_IGNORE_DUPS set, I
don't expect to see two identical history lines in a row when moving
up or down in the history, but this is possible if the duplicate
lines are separated by foreign history lines. A simple tweak to
the up/down history code causes it to skip any identical, adjacent
lines if HIST_IGNORE_DUPS is set.
The other change fixes Doc/Zsh/options.yo -- it still had two
references to INCREMENTAL_APPEND_HISTORY rather than the shorted
option name, INC_APPEND_HISTORY.
..wayne..
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
--- zsh-3.1.5-pws-20/Doc/Zsh/options.yo Tue May 11 08:08:45 1999
+++ Doc/Zsh/options.yo Tue Jun 1 23:24:14 1999
@@ -834,7 +834,7 @@
This option both imports new commands from the history file, and also
causes your typed commands to be appended to the history file (like
-specifiying tt(INCREMENTAL_APPEND_HISTORY)). The history lines are also
+specifiying tt(INC_APPEND_HISTORY)). The history lines are also
output with timestamps ala tt(EXTENDED_HISTORY) (which makes it easier to
find the spot where we left off reading the file after it gets re-written).
@@ -846,7 +846,7 @@
If you find that you want more control over when commands
get imported, you may wish to turn tt(SHARE_HISTORY) off,
-tt(INCREMENTAL_APPEND_HISTORY) on, and then manually import
+tt(INC_APPEND_HISTORY) on, and then manually import
commands whenever you need them using `fc -RI'.
)
pindex(SH_FILE_EXPANSION)
--- zsh-3.1.5-pws-20/Src/Zle/zle_hist.c Tue May 11 02:20:52 1999
+++ Src/Zle/zle_hist.c Tue Jun 1 23:24:35 1999
@@ -76,7 +76,8 @@
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 @@
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 @@
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 @@
void
endofhistory(void)
{
- zle_goto_hist(curhist, 0);
+ zle_goto_hist(curhist, 0, 0);
}
/**/
@@ -472,9 +474,14 @@
/**/
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 @@
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();
}
--- zsh-3.1.5-pws-20/Src/Zle/zle_move.c Sat May 8 05:31:49 1999
+++ Src/Zle/zle_move.c Tue Jun 1 23:24:35 1999
@@ -476,7 +476,7 @@
feep();
return;
}
- if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0)) {
+ if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0, 0)) {
vimarkline[ch] = 0;
feep();
return;
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Messages sorted by:
Reverse Date,
Date,
Thread,
Author