From f8220437f22852d72d4a8ab2ed86afb5f5f21cce Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 28 Apr 2008 15:45:41 +0000 Subject: unposted: reset search line on anchored pattern isearch --- Src/Zle/zle_hist.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'Src/Zle/zle_hist.c') 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) { -- cgit 1.4.1