Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: muddled completion search status
- X-seq: zsh-workers 35496
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: muddled completion search status
- Date: Wed, 17 Jun 2015 00:35:10 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1434494111; bh=M7u5+YxafTKV0wY4jgWzpT5fTsd8AwObaf+9EmCN77E=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=BEJbnRh0LQfjEj2MDMNw1MQLEuPjnZRmh+I59JJYnH9nQZXHF1mzgRiVLHCsOG1zkoZYXkIbW1RW5TComADEEQ8jBY0fuzSOMW3dq7zjf13IcRj7Go6nZ6lzUSlVui2+ROoQC4AY9Ie56E23OQr0vS9mlZ1+jFsSteRswkm988wAoyMVSlcMc48GWCMIYcm9Ybb7wAM43iQgpnSSicnnh6cc9r8Ct1i8hNMnB8gkape8sB75YR1x+50EY1uUHekNfdaQ1inpc9qSrWFawLWitq6JjOOKZK1xeTDfPgZmOlQnBj4UQ3GTEPSYq+n1GYysgH3HsmLh+3a7NaksCybJ3w==
- In-reply-to: <23493.1434450587@thecus.kiddle.eu>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <23493.1434450587@thecus.kiddle.eu>
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