Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: (rfc) HIST_FIND_DUPS option
- X-seq: zsh-workers 29207
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: (rfc) HIST_FIND_DUPS option
- Date: Tue, 10 May 2011 00:09:31 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=YeiBqdkLmSwfL4u50WTWR6vt4DhTXHq1IMqU2LnkMiU=; b=RekA01xYM5rIDr8ICuhficHSVjEF680TjV9TdZaUeAol+Sq6/8rpUX+zUjHcET+m/w zmwc0Eb1eGzDxClxNjZD8Cd84sqL7c0pspxmy4pVUFQhSyRMfzVf6xl3jeiyquz2ZE9k nEfhBe+fkJi4WkmvJvx7OM40sbm8RZYO+lQew=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=SA9+LF30Dj6j3BcXN/Sp9GOjckAzgjjHhoFjKqWXVT7n7xVSpPtFJZdJylnoCUnYnh bw11dQqK7Ry6YIKgy0xSpRQFlD/eJI+ksXHKvyUd4RPs5cvKDOlOvGX3zvo8ivbVSAsf Q7kMxPTqtqyaIPxsWYJ68VyXq9jBgub2NONKo=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Add HIST_FIND_DUPS option so ctrl-r finds identical lines, useful when
you want to ctrl-o through some and it found the wrong sequence. For
example if you have this history:
command you remember
command you want to run
5000 other commands
command you remember
useless command
I am currently unsure why unsetting HIST_FIND_NO_DUPS doesn't have
this behaviour already. Possibly it only finds the same line after
finding another line in between that also matches the search, this
seems like a weird distinction to make to me (if this is the case).
patch if someone wants to try it, not for committing of course since i
didn't add docs:
http://cgit.mika.l3ib.org/cgit/zsh-cvs/commit/?id=034f471caa87
corrupted patch to look at:
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index ed524d3..51d8667 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1415,7 +1415,9 @@ doisearch(char **args, int dir, int pattern)
else
skip_line = isset(HISTFINDNODUPS)
? !!(he->node.flags & HIST_DUP)
- : !strcmp(zt, last_line);
+ : isset(HISTFINDDUPS)
+ ? 0
+ : !strcmp(zt, last_line);
}
dup_ok = 0;
/*
diff --git a/Src/options.c b/Src/options.c
index 1ce9f41..2b88c7a 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -146,6 +146,7 @@ static struct optname optns[] = {
{{NULL, "histbeep", OPT_ALL}, HISTBEEP},
{{NULL, "histexpiredupsfirst",0}, HISTEXPIREDUPSFIRST},
{{NULL, "histfcntllock", 0}, HISTFCNTLLOCK},
+{{NULL, "histfinddups", 0}, HISTFINDDUPS},
{{NULL, "histfindnodups", 0}, HISTFINDNODUPS},
{{NULL, "histignorealldups", 0}, HISTIGNOREALLDUPS},
{{NULL, "histignoredups", 0}, HISTIGNOREDUPS},
diff --git a/Src/zsh.h b/Src/zsh.h
index 7f28f69..ba324ac 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1988,6 +1988,7 @@ enum {
HISTBEEP,
HISTEXPIREDUPSFIRST,
HISTFCNTLLOCK,
+ HISTFINDDUPS,
HISTFINDNODUPS,
HISTIGNOREALLDUPS,
HISTIGNOREDUPS,
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author