From 0a0ba5e6641a8a78d745928e5738c95cc5353ee0 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 18 Jun 2015 23:55:45 +0200 Subject: 35487, 35496: don't reinstate previous incremental search string when search direction changes --- ChangeLog | 4 ++++ Doc/Zsh/zle.yo | 4 +++- Src/Zle/complist.c | 4 +++- Src/Zle/zle_hist.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42b25a74d..0a0bd36a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-06-18 Oliver Kiddle + * 35487, 35496: Doc/Zsh/zle.yo, Src/Zle/complist.c, + Src/Zle/zle_hist.c: don't reinstate previous incremental search + string when search direction changes + * 35510: Completion/Unix/Command/_git: use consistent formatting for git subcommands diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index 16d661f06..a89f566c3 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -1360,7 +1360,9 @@ item(tt(clear-screen))( Clear the screen, remaining in incremental search mode. ) item(tt(history-incremental-search-backward))( -Find the next occurrence of the contents of the mini-buffer. +Find the next occurrence of the contents of the mini-buffer. If the +mini-buffer is empty, the most recent previously used search string is +reinstated. ) item(tt(history-incremental-search-forward))( Invert the sense of the search. diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index a02a5c37b..39c0c314d 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -3287,13 +3287,15 @@ domenuselect(Hookdef dummy, Chdata dat) } if (!ins) { if (was) { - if (!*msearchstr && lastsearch) { + if (!*msearchstr && lastsearch && + back == (mode == MM_BSEARCH)) { msearchstr = dupstring(lastsearch); mode = 0; } } else { msearchstr = ""; msearchstack = NULL; + msearchstate = MS_OK; } } if (cmd == Th(z_selfinsertunmeta)) { diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c index cc66f99ae..0b3b9e7b7 100644 --- a/Src/Zle/zle_hist.c +++ b/Src/Zle/zle_hist.c @@ -1598,7 +1598,7 @@ doisearch(char **args, int dir, int pattern) dir = odir; skip_pos = 1; rpt: - if (!sbptr && previous_search_len) { + if (!sbptr && previous_search_len && dir == odir) { if (previous_search_len > sibuf - FIRST_SEARCH_CHAR - 2) { ibuf = hrealloc((char *)ibuf, sibuf, (sibuf + previous_search_len)); -- cgit 1.4.1