about summary refs log tree commit diff
path: root/Src/Zle/zle_hist.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-05-01 11:33:02 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-05-01 11:33:02 +0000
commita8854f71ebb7670e49cf0481f26ede1c807ba177 (patch)
treef2eec2b2733646d931f2d15d29ed929a8d6f8908 /Src/Zle/zle_hist.c
parentfadf4a55ffa9209f1988e7bd85f2940ef592d26f (diff)
downloadzsh-a8854f71ebb7670e49cf0481f26ede1c807ba177.tar.gz
zsh-a8854f71ebb7670e49cf0481f26ede1c807ba177.tar.xz
zsh-a8854f71ebb7670e49cf0481f26ede1c807ba177.zip
24900: add backward-kill-word behaviour to isearch
document isearch commands better
Diffstat (limited to 'Src/Zle/zle_hist.c')
-rw-r--r--Src/Zle/zle_hist.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 9d4692305..c69f8539a 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1445,26 +1445,37 @@ doisearch(char **args, int dir, int pattern)
 	    if(selectkeymap(invicmdmode() ? "main" : "vicmd", 0))
 		feep = 1;
 	    goto ref;
-       } else if(cmd == Th(z_vibackwarddeletechar) ||
-               cmd == Th(z_backwarddeletechar)) {
-           if (top_spot) {
-               get_isrch_spot(--top_spot, &hl, &pos, &pat_hl, &pat_pos,
-                              &end_pos, &zlemetacs, &sbptr, &dir, &nomatch);
-               patprog = NULL;
-               nosearch = 1;
-               skip_pos = 0;
-           } else
-               feep = 1;
-           if (nomatch) {
-               memcpy(ibuf, nomatch == 2 ? INVALID_TEXT : FAILING_TEXT,
-                      BAD_TEXT_LEN);
-               statusline = ibuf;
-               skip_pos = 1;
+       } else if (cmd == Th(z_vibackwarddeletechar) ||
+		  cmd == Th(z_backwarddeletechar) ||
+		  cmd == Th(z_vibackwardkillword) ||
+		  cmd == Th(z_backwardkillword) ||
+		  cmd == Th(z_backwarddeleteword)) {
+	    int only_one = (cmd == Th(z_vibackwarddeletechar) ||
+			    cmd == Th(z_backwarddeletechar));
+	    int old_sbptr = sbptr;
+	    if (top_spot) {
+		for (;;) {
+		    get_isrch_spot(--top_spot, &hl, &pos, &pat_hl,
+				   &pat_pos,  &end_pos, &zlemetacs,
+				   &sbptr, &dir, &nomatch);
+		    if (only_one || !top_spot || old_sbptr != sbptr)
+			break;
+		}
+		patprog = NULL;
+		nosearch = 1;
+		skip_pos = 0;
+	    } else
+		feep = 1;
+	    if (nomatch) {
+		memcpy(ibuf, nomatch == 2 ? INVALID_TEXT : FAILING_TEXT,
+		       BAD_TEXT_LEN);
+		statusline = ibuf;
+		skip_pos = 1;
 	    }
 	    he = quietgethist(hl);
 	    zt = GETZLETEXT(he);
 	    /*
-	     * Set the line for the cases where we won't go passed
+	     * Set the line for the cases where we won't go past
 	     * the usual line-setting logic:  if we're not on a match,
 	     * or if we don't have enough to search for.
 	     */