* Darwin _defaults completion bug
@ 2005-02-04 4:45 lists
2005-02-18 6:55 ` Motoi Washida
0 siblings, 1 reply; 3+ messages in thread
From: lists @ 2005-02-04 4:45 UTC (permalink / raw)
To: Motoi Washida; +Cc: zsh-users
Hi Motoi,
I think I've found a small bug with your _defaults completion (which I
use all the time). If I type 'defaults read -g' then hit the Tab key,
I see a list of possible completions which are quoted *and* escaped
with a backslash. Here's what I mean:
% zsh -f
% autoload -U compinit
% compinit -C -d ~/.zcompdump_$ZSH_VERSION
% defaults read -g <TAB>
\"com.apple.AppleShareClientCore\"
\"com.apple.keyboard.fnState\"
\"com.apple.mouse.ignoreTrackpadIfMousePresent\"
\"com.apple.mouse.ignoreTypingFilter\"
\"com.apple.mouse.tapBehavior\"
\"com.apple.sound.beep.feedback\"
\"com.apple.trackpad.scaling\"
AppleAntiAliasingThreshold
...et cetera, et cetera. The command doesn't work in the escaped +
quoted form. If just the quotes are used, the command works. I've
looked at _defaults but haven't been able to figure out where the
escapes are being inserted. If you get a chance, could you take a
look?
Thanks,
Ryan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Darwin _defaults completion bug
2005-02-04 4:45 Darwin _defaults completion bug lists
@ 2005-02-18 6:55 ` Motoi Washida
2005-02-18 14:22 ` lists
0 siblings, 1 reply; 3+ messages in thread
From: Motoi Washida @ 2005-02-18 6:55 UTC (permalink / raw)
To: lists; +Cc: zsh-users
Hi Ryan,
> I think I've found a small bug with your _defaults completion (which
> I use all the time). If I type 'defaults read -g' then hit the Tab
> key, I see a list of possible completions which are quoted *and*
> escaped with a backslash.
(...snip...)
> ...et cetera, et cetera. The command doesn't work in the escaped +
> quoted form. If just the quotes are used, the command works. I've
> looked at _defaults but haven't been able to figure out where the
> escapes are being inserted. If you get a chance, could you take a
> look?
Thanks! This occurred because the completion did not handle quoted key
name "defaults read" prints. Here is a patch to remove quotes.
--
Motoi Washida
Index: Completion/Darwin/Command/_defaults
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Darwin/Command/_defaults,v
retrieving revision 1.2
diff -d -u -r1.2 _defaults
--- Completion/Darwin/Command/_defaults 17 Jan 2005 09:39:21 -0000 1.2
+++ Completion/Darwin/Command/_defaults 18 Feb 2005 06:24:58 -0000
@@ -14,9 +14,10 @@
}
_defaults_keys(){
- local ks="$(_call_program keys defaults read "$words[2]" 2>/dev/null
| sed '/^ [[:alpha:]"]/ { s/^ //; s/ = .*$//; p;}; d')"
+ local ks
+ ks=(${${${${(M)${(f)"$(defaults read "$words[2]" 2>/dev/null)"}:#
[^ ]*=*}# }%% = *}:Q})
local expl
- _wanted keys expl 'key' compadd ${(f)ks}
+ _wanted keys expl 'key' compadd "$ks[@]"
}
_defaults(){
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Darwin _defaults completion bug
2005-02-18 6:55 ` Motoi Washida
@ 2005-02-18 14:22 ` lists
0 siblings, 0 replies; 3+ messages in thread
From: lists @ 2005-02-18 14:22 UTC (permalink / raw)
To: Motoi Washida; +Cc: zsh-users
Hi Motoi,
That works great. Thanks again for your contributions to the OS X zsh
community!
-Ryan
On Feb 18, 2005, at 12:55 AM, Motoi Washida wrote:
> Hi Ryan,
>
>> I think I've found a small bug with your _defaults completion (which
>> I use all the time). If I type 'defaults read -g' then hit the Tab
>> key, I see a list of possible completions which are quoted *and*
>> escaped with a backslash.
> (...snip...)
>> ...et cetera, et cetera. The command doesn't work in the escaped +
>> quoted form. If just the quotes are used, the command works. I've
>> looked at _defaults but haven't been able to figure out where the
>> escapes are being inserted. If you get a chance, could you take a
>> look?
> Thanks! This occurred because the completion did not handle quoted key
> name "defaults read" prints. Here is a patch to remove quotes.
>
> --
> Motoi Washida
>
> Index: Completion/Darwin/Command/_defaults
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Completion/Darwin/Command/_defaults,v
> retrieving revision 1.2
> diff -d -u -r1.2 _defaults
> --- Completion/Darwin/Command/_defaults 17 Jan 2005 09:39:21 -0000 1.2
> +++ Completion/Darwin/Command/_defaults 18 Feb 2005 06:24:58 -0000
> @@ -14,9 +14,10 @@
> }
>
> _defaults_keys(){
> - local ks="$(_call_program keys defaults read "$words[2]"
> 2>/dev/null | sed '/^ [[:alpha:]"]/ { s/^ //; s/ = .*$//; p;};
> d')"
> + local ks
> + ks=(${${${${(M)${(f)"$(defaults read "$words[2]" 2>/dev/null)"}:#
> [^ ]*=*}# }%% = *}:Q})
> local expl
> - _wanted keys expl 'key' compadd ${(f)ks}
> + _wanted keys expl 'key' compadd "$ks[@]"
> }
>
> _defaults(){
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-02-18 15:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-04 4:45 Darwin _defaults completion bug lists
2005-02-18 6:55 ` Motoi Washida
2005-02-18 14:22 ` lists
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).