zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: _subscript quotes too much
Date: Wed, 9 Apr 2008 13:11:59 +0100	[thread overview]
Message-ID: <20080409131159.2e2389c6@news01> (raw)
In-Reply-To: <237967ef0804090453i19952670ic40093e119bcd983@mail.gmail.com>

On Wed, 9 Apr 2008 13:53:00 +0200
"Mikael Magnusson" <mikachu@gmail.com> wrote:
> Well,
> typeset -A hi
> hi=(\" hello)
> echo $hi[<tab>
> 
> should ideally produce "$hi[\"]" but I don't even know if that's
> possible or worth it. :) Or even

Double quotes are really hard and I think I'll pretend they don't exist.
The fact that foo["]=stuff doesn't work (it's waiting for a closing quote)
while foo[\"]=stuff assigns to an element \", including the backslash,
doesn't fill me with zeal for handling this in completion.

> hi=(\* hello)
> echo $hi[<tab>
> would produce $hi[(e)*]

That's easy.

Index: Completion/Zsh/Context/_subscript
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_subscript,v
retrieving revision 1.13
diff -u -r1.13 _subscript
--- Completion/Zsh/Context/_subscript	9 Apr 2008 11:25:41 -0000	1.13
+++ Completion/Zsh/Context/_subscript	9 Apr 2008 12:06:21 -0000
@@ -70,7 +70,7 @@
   local suf MATCH MBEGIN MEND
   local -a keys
   keys=(${${(kP)compstate[parameter]}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH})
-
+  keys=(${keys//#%(#m)[*@]/(e)$MATCH})
   [[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf"
 
   _wanted association-keys expl 'association key' \
Index: Doc/Zsh/params.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.46
diff -u -r1.46 params.yo
--- Doc/Zsh/params.yo	3 Apr 2008 08:46:50 -0000	1.46
+++ Doc/Zsh/params.yo	9 Apr 2008 12:06:23 -0000
@@ -344,8 +344,8 @@
 braces (`tt({)' and `tt(})'): they must appear either in balanced pairs or
 preceded by a backslash, and backslashes that protect parentheses or
 braces are removed during parsing.  This is because parameter expansions
-may be surrounded balanced braces, and subscript flags are introduced by
-balanced parenthesis.
+may be surrounded by balanced braces, and subscript flags are introduced by
+balanced parentheses.
 
 The second difference is that a double-quote (`tt(")') may appear as part
 of a subscript expression without being preceded by a backslash, and




-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


      reply	other threads:[~2008-04-09 12:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09  0:08 Mikael Magnusson
2008-04-09  0:11 ` Mikael Magnusson
2008-04-09  8:49   ` Peter Stephenson
2008-04-09 11:00     ` Peter Stephenson
2008-04-09 11:20       ` Peter Stephenson
2008-04-09 11:53         ` Mikael Magnusson
2008-04-09 12:11           ` 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=20080409131159.2e2389c6@news01 \
    --to=pws@csr.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).