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

Re: vi-backward-kill-word



Another minor bug in vi mode.

If you enter a combined char and delete it in vi-insert mode by ctrl-H
(bound to vi-backward-delete-char), then only the base char is deleted.

In this case, vibackwarddeletechar() calls backkill() without setting
CUT_RAW flag. backkill() correclty finds the new zlecs but does not
re-calculate the number of raw chars to be killed (the variable ct).
A possible fix may be the following:


Index: Src/Zle/zle_utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_utils.c,v
retrieving revision 1.52
diff -u -r1.52 zle_utils.c
--- Src/Zle/zle_utils.c	21 Apr 2008 17:58:59 -0000	1.52
+++ Src/Zle/zle_utils.c	24 Apr 2008 09:48:38 -0000
@@ -589,20 +589,18 @@
 mod_export void
 backkill(int ct, int flags)
 {
-    int i;
-
     UNMETACHECK();
     if (flags & CUT_RAW) {
-	i = (zlecs -= ct);
+	zlecs -= ct;
     } else {
-	int n = ct;
-	while (n--)
+	int origcs = zlecs;
+	while (ct--)
 	    DECCS();
-	i = zlecs;
+	ct = origcs - zlecs;
     }
 
-    cut(i, ct, flags);
-    shiftchars(i, ct);
+    cut(zlecs, ct, flags);
+    shiftchars(zlecs, ct);
     CCRIGHT();
 }
 

------
Jun



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