about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Doc/Zsh/mod_deltochar.yo2
-rw-r--r--Src/Zle/deltochar.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/Doc/Zsh/mod_deltochar.yo b/Doc/Zsh/mod_deltochar.yo
index 4c3cf58e6..d90a6fc47 100644
--- a/Doc/Zsh/mod_deltochar.yo
+++ b/Doc/Zsh/mod_deltochar.yo
@@ -6,7 +6,7 @@ startitem()
 tindex(delete-to-char)
 item(tt(delete-to-char))(
 Read a character from the keyboard, and
-delete from the cursor position up to and including the next
+delete from the cursor position up to but not including the next
 (or, with repeat count var(n), the var(n)th) instance of that character.
 )
 enditem()
diff --git a/Src/Zle/deltochar.c b/Src/Zle/deltochar.c
index f0df33f95..d6a579d5c 100644
--- a/Src/Zle/deltochar.c
+++ b/Src/Zle/deltochar.c
@@ -43,7 +43,8 @@ deltochar(char **args)
 	    while (dest != ll && line[dest] != c)
 		dest++;
 	    if (dest != ll) {
-		dest++;
+		if (n > 0)
+		    dest++;
 		if (!n) {
 		    forekill(dest - cs, 0);
 		    ok++;
@@ -59,7 +60,7 @@ deltochar(char **args)
 		dest--;
 	    if (line[dest] == c) {
 		if (!n) {
-		    backkill(cs - dest, 1);
+		    backkill(cs - dest - 1, 1);
 		    ok++;
 		}
 		if (dest)