zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@sunsite.dk
Subject: Re: vi-backward-kill-word
Date: Thu, 24 Apr 2008 19:35:07 +0900	[thread overview]
Message-ID: <a0600100cc43612ae5cce@kba.biglobe.ne.jp> (raw)

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


             reply	other threads:[~2008-04-24 10:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24 10:35 Jun T. [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-04-21 16:10 vi-backward-kill-word Jun T.
2008-04-21 17:27 ` vi-backward-kill-word Peter Stephenson
2008-04-21 17:57   ` vi-backward-kill-word Peter Stephenson
2008-04-22 17:56   ` vi-backward-kill-word Jun T.
2008-04-23  8:32     ` vi-backward-kill-word Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a0600100cc43612ae5cce@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).