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

[PATCH] Fix anchoring for vi-history-search-* widgets



According to the zshzle(1) manual, the search string specified via
vi-history-search-backward or vi-history-search-forward "may begin with
`^' to anchor the search to the beginning of the line."  This didn't
work, because the code which compares the search string with a given
history entry checked whether the latter is a prefix of the former,
instead of the other way around.
---
 Src/Zle/zle_hist.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index c9ffda4..5b57f44 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1942,7 +1942,7 @@ virepeatsearch(UNUSED(char **args))
 	    continue;
 	zt = GETZLETEXT(he);
 	if (zlinecmp(zt, zlemetaline) &&
-	    (*visrchstr == '^' ? strpfx(zt, visrchstr + 1) :
+	    (*visrchstr == '^' ? strpfx(visrchstr + 1, zt) :
 	     zlinefind(zt, 0, visrchstr, 1, 1) != 0)) {
 	    if (--n <= 0) {
 		unmetafy_line();
-- 
Holger



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