about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-04-28 15:45:41 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-04-28 15:45:41 +0000
commitf8220437f22852d72d4a8ab2ed86afb5f5f21cce (patch)
tree10b7c8f2a5a971cdae74ef560b0cb212cfa9662a
parent7462e3f97882ab00933a1a1704b67622e853c89e (diff)
downloadzsh-f8220437f22852d72d4a8ab2ed86afb5f5f21cce.tar.gz
zsh-f8220437f22852d72d4a8ab2ed86afb5f5f21cce.tar.xz
zsh-f8220437f22852d72d4a8ab2ed86afb5f5f21cce.zip
unposted: reset search line on anchored pattern isearch
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_hist.c24
2 files changed, 18 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e8ca9046..172136b39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-04-28  Peter Stephenson  <pws@csr.com>
 
+	* unposted: Src/Zle/zle_hist.c: when anchoring a pattern
+	isearch to the start of the line the search line wasn't
+	reset on new input so when the first match of the new pattern
+	was earlier than that of the old pattern we skipped it.
+
 	* unposted: Src/Zle/zle_hist.c: more tweaks for failures with
 	isearch pattern matching.
 
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index be52210cc..9d4692305 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1214,6 +1214,19 @@ doisearch(char **args, int dir, int pattern)
 	     */
 	    while ((!pattern || patprog) && !nosearch) {
 		if (patprog) {
+		    if (revert_patpos) {
+			/*
+			 * Search from where the previous
+			 * search started; see note above.
+			 * This is down here within the loop because of
+			 * the "nosearch" optimisation.
+			 */
+			revert_patpos = 0;
+			dup_ok = 1;
+			he = quietgethist(hl = pat_hl);
+			zt = GETZLETEXT(he);
+			pos = pat_pos;
+		    }
 		    /*
 		     * We are pattern matching against the current
 		     * line.  If anchored at the start, this is
@@ -1245,17 +1258,6 @@ doisearch(char **args, int dir, int pattern)
 				t = zt;
 			} else {
 			    if (!matchlist && !skip_pos) {
-				if (revert_patpos) {
-				    /*
-				     * Search from where the previous
-				     * search started; see note above.
-				     */
-				    revert_patpos = 0;
-				    dup_ok = 1;
-				    he = quietgethist(hl = pat_hl);
-				    zt = GETZLETEXT(he);
-				    pos = pat_pos;
-				}
 				if (!getmatchlist(zt, patprog, &matchlist) ||
 				    !firstnode(matchlist)) {
 				    if (matchlist) {