zsh-workers
 help / color / mirror / code / Atom feed
* some more problems with delete-whole-word-match, no patch
@ 2007-11-09 15:56 Mikael Magnusson
  2007-11-10 18:54 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2007-11-09 15:56 UTC (permalink / raw)
  To: zsh-workers

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

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.

-- 
Mikael Magnusson


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

* Re: some more problems with delete-whole-word-match, no patch
  2007-11-09 15:56 some more problems with delete-whole-word-match, no patch Mikael Magnusson
@ 2007-11-10 18:54 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2007-11-10 18:54 UTC (permalink / raw)
  To: zsh-workers

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/


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

end of thread, other threads:[~2007-11-10 18:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-09 15:56 some more problems with delete-whole-word-match, no patch Mikael Magnusson
2007-11-10 18:54 ` 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).