zsh-workers
 help / color / mirror / code / Atom feed
* Bug in url-quote-magic?
@ 2006-06-12 16:10 Ulrich Dangel
  2006-06-13 14:08 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Dangel @ 2006-06-12 16:10 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

Hi,
while using url-quote-magic i discoverd a strange behaviour.
If i enter an url, followed by space, and after that a semicolon, the
semicolon is escaped. This is really ugly if i use something like
,----
| while mplayer $url ; do 
|    sleep 10 ; 
| done 
`----

because this gets to, 

,----
| while mplayer $url \; do ..
`----

I attached the diff, hope it helps someone :)

Uli

[-- Attachment #2: url-quote-diff --]
[-- Type: text/plain, Size: 471 bytes --]

--- /usr/share/zsh/4.3.2/functions/Zle/url-quote-magic  2006-05-20 19:55:36.000000000 +0200
+++ url-quote-magic     2006-06-06 01:36:56.332676750 +0200
@@ -108,7 +108,7 @@
 function url-quote-magic {
     setopt localoptions noksharrays extendedglob
     local qkey="${(q)KEYS}"
-    if [[ "$KEYS" != "$qkey" ]]
+    if [[ "$KEYS" != "$qkey" && "$LBUFFER[-1]" != " " ]] 
     then
        local lbuf="$LBUFFER$qkey"
        if [[ "${(Q)LBUFFER}$KEYS" == "${(Q)lbuf}" ]]


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

* Re: Bug in url-quote-magic?
  2006-06-12 16:10 Bug in url-quote-magic? Ulrich Dangel
@ 2006-06-13 14:08 ` Bart Schaefer
  2006-06-14  4:20   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2006-06-13 14:08 UTC (permalink / raw)
  To: zsh-workers

On Jun 12,  6:10pm, Ulrich Dangel wrote:
}
} while using url-quote-magic i discoverd a strange behaviour.
} If i enter an url, followed by space, and after that a semicolon, the
} semicolon is escaped.

I can see where this might be unexpected, but I'm not sure your fix is
the right one.  I think it might be preferable to change line 117 so
that the trailing space is preserved, i.e., so that it can tell that
the last word on the line is no longer the one that looks like a URL.

            words=("${(@Q)${(q)=LBUFFER}}") # 117: Not quite right

I haven't worked out how to do this yet and don't have time to this
morning, I'm afraid.


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

* Re: Bug in url-quote-magic?
  2006-06-13 14:08 ` Bart Schaefer
@ 2006-06-14  4:20   ` Bart Schaefer
  2006-09-20 16:34     ` Ulrich Dangel
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2006-06-14  4:20 UTC (permalink / raw)
  To: zsh-workers

On Jun 13,  7:08am, Bart Schaefer wrote:
} Subject: Re: Bug in url-quote-magic?
}
} On Jun 12,  6:10pm, Ulrich Dangel wrote:
} }
} } while using url-quote-magic i discoverd a strange behaviour.
} } If i enter an url, followed by space, and after that a semicolon, the
} } semicolon is escaped.
} 
} I can see where this might be unexpected, but I'm not sure your fix is
} the right one.  I think it might be preferable to change line 117

This seems to do the trick; let me know.

Index: Functions/Zle/url-quote-magic
===================================================================
--- Functions/Zle/url-quote-magic	14 Feb 2004 19:39:27 -0000
+++ Functions/Zle/url-quote-magic	14 Jun 2006 04:18:31 -0000
@@ -114,7 +114,7 @@
 	if [[ "${(Q)LBUFFER}$KEYS" == "${(Q)lbuf}" ]]
 	then
 	    local -a words
-	    words=("${(@Q)${(q)=LBUFFER}}")
+	    words=("${(@Q)${(z)lbuf}}")
 	    local urlseps urlmetas urlglobbers localschema otherschema
 	    if [[ "$words[-1]" == (#b)([^:]##):* ]]
 	    then


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

* Re: Bug in url-quote-magic?
  2006-06-14  4:20   ` Bart Schaefer
@ 2006-09-20 16:34     ` Ulrich Dangel
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Dangel @ 2006-09-20 16:34 UTC (permalink / raw)
  To: zsh-workers

* Bart Schaefer wrote [14.06.06 06:20]:
Hi,
> } I can see where this might be unexpected, but I'm not sure your fix is
> } the right one.  I think it might be preferable to change line 117
> 
> This seems to do the trick; let me know.
 
Yes, it works like a charm :)

Sorry for the long outstanding answer :(

Uli
-- 
You're working under a slight handicap.  You happen to be human.


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

end of thread, other threads:[~2006-09-20 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-12 16:10 Bug in url-quote-magic? Ulrich Dangel
2006-06-13 14:08 ` Bart Schaefer
2006-06-14  4:20   ` Bart Schaefer
2006-09-20 16:34     ` Ulrich Dangel

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