zsh-workers
 help / color / mirror / code / Atom feed
* Re: vi-backward-kill-word
@ 2008-04-24 10:35 Jun T.
  0 siblings, 0 replies; 6+ messages in thread
From: Jun T. @ 2008-04-24 10:35 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 6+ messages in thread
* vi-backward-kill-word
@ 2008-04-21 16:10 Jun T.
  2008-04-21 17:27 ` vi-backward-kill-word Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Jun T. @ 2008-04-21 16:10 UTC (permalink / raw)
  To: zsh-workers

Since you wrote in your first post:
 >Known gaps at the moment:
 >- Word tests need improving (a whole smattering HEREs)
 >- Vi "r" needs some work (another HERE)

I guess you already know that vi "r" and "R" do not work properly
on combined character(s).
Another minor problem is, when  in vi-insert mode, ^W
(vi-backward-kill-word) kills wrong part of the line if the word
to be killed contains combined character.

zsh -f
bindkey -v
echo é<^W>
echó
(Here é is in decomposed form: e + U+0301).

The word "é" must be killed, but what is actually killed is " e"
(a space and "e"), leaving the combining character.

It *seems* it can be fixed by replacing the line 44 of zle_word.c
     backkill(zlecs - x, CUT_FRONT);
by
     backkill(zlecs - x, CUT_FRONT|CUT_RAW);

In the present case, the comgining character(s) are already taken
accout of by vibackwardkillword(), and 'zlecs - x' is the number
of wchar_t to be killed. So I *guess* CUT_RAW should be used here.
Am I right?

# I guess you are busy working on many problems.
# I fear I'm disturbing you...

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-24 10:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-24 10:35 vi-backward-kill-word Jun T.
  -- 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

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).