zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: some more problems with delete-whole-word-match, no patch
Date: Sat, 10 Nov 2007 18:54:42 +0000	[thread overview]
Message-ID: <20071110185442.6969a728.p.w.stephenson@ntlworld.com> (raw)
In-Reply-To: <237967ef0711090756l453c1e07l620faf91e143dac6@mail.gmail.com>

On Fri, 9 Nov 2007 16:56:56 +0100
"Mikael Magnusson" <mikachu@gmail.com> wrote:
> 1)
> if you have two or more spaces between two words and position the
> cursor between them, invoking the widget will insert an extra space.
> 2)
> if you position the cursor at the end of the word, the widget leaves
> the last character of the word intact, if there is a trailing space
> (as there usually is if the word isn't the last word on the command
> line).

(You mean with the cursor on the whitespace itself.)

> Putting in a [[ $pos1 = $pos2 ]] && return seems to fix the first
> problem but I figured the problems are probably related somehow, and
> I'm not sure why the second occurs.

You're right, it's the same bug.  If there's whitespace at the cursor
position it gets the end position one too short.

Index: Functions/Zle/delete-whole-word-match
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Zle/delete-whole-word-match,v
retrieving revision 1.5
diff -u -r1.5 delete-whole-word-match
--- Functions/Zle/delete-whole-word-match	10 Nov 2007 17:37:55 -0000	1.5
+++ Functions/Zle/delete-whole-word-match	10 Nov 2007 18:52:58 -0000
@@ -31,7 +31,7 @@
 if [[ -n "${matched_words[4]}" ]]; then
     # There's whitespace at the cursor position, so only delete
     # up to the cursor position.
-    pos2=$CURSOR
+    (( pos2 = CURSOR + 1 ))
 else
     # No whitespace at the cursor position, so delete the
     # current character and any following wordcharacters.


-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


      reply	other threads:[~2007-11-10 18:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09 15:56 Mikael Magnusson
2007-11-10 18:54 ` Peter Stephenson [this message]

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=20071110185442.6969a728.p.w.stephenson@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --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).