Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: muddled completion search status



I wrote:
> There's a further feature where if you press Ctrl-S (or whatever) again,
> it will restore the last search string used. This feature is also
> triggered if your next key is that for a reverse search.

After checking, I noticed that this is exactly the same for history
incremental search. Again, I think it is better not to restore the
previous search string if the search direction has changed.

This also adds brief documentation of the feature.

Oliver

diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 16d661f..ac66ea9 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/zle_hist.c b/Src/Zle/zle_hist.c
index cc66f99..0b3b9e7 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));



Messages sorted by: Reverse Date, Date, Thread, Author