zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: (rfc) HIST_FIND_DUPS option
@ 2011-05-09 22:09 Mikael Magnusson
  2011-05-09 23:51 ` Wayne Davison
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2011-05-09 22:09 UTC (permalink / raw)
  To: zsh workers

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-10  5:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-09 22:09 PATCH: (rfc) HIST_FIND_DUPS option Mikael Magnusson
2011-05-09 23:51 ` Wayne Davison
2011-05-10  0:03   ` Mikael Magnusson
2011-05-10  5:08     ` Wayne Davison

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).