zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Borsenkow Andrej <Andrej.Borsenkow@mow.siemens.ru>,
	Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: problem with quoting in completion function
Date: Sun, 14 Apr 2002 05:03:08 +0000	[thread overview]
Message-ID: <1020414050308.ZM7620@candle.brasslantern.com> (raw)
In-Reply-To: <1018728981.6553.7.camel@localhost.localdomain>
In-Reply-To: <1018729436.6553.13.camel@localhost.localdomain>

On Apr 14, 12:16am, Borsenkow Andrej wrote:
}
} I spent some time trying to understand why the following (suggested by
} Sven) does not work:
} 
}  compset -P "*,"
}  all_sources=( ${all_sources:#(${~IPREFIX//,/|})} )

On Apr 14, 12:23am, Borsenkow Andrej wrote:
}
} > It turned out, completion internally quotes IPREFIX,
} 
} Of course it does not quote IPREFIX. It quotes word inserted in command
} line that becomes IPREFIX on next try.
} 
} Is there any general way inside completion to "dequote" word from
} command line? 

I was going to compare this to Jeremy Dolan's bug from the other day, but
after a bit of thought I see that it isn't, really -- the quoting of the
IPREFIX theoretically shouldn't matter, because it's ignored, after all.

I wonder if ${(Q)IPREFIX} would do what you need?  What should happen if
the ignored prefix contains e.g. an unmatched single-quote?  Probably you
should examine $compstate[all_quotes] to decide what to do.

Here's a different example of Jeremy's bug:

schaefer<512> ls "foo\<TAB>
Completing corrections
foo\!baz   foo\!bar 
Completing original
foo\\

Note that it thinks the original string has two backslashes, and only
supplies the other two choices as corrections.

In that case, the completion internals really did quote $PREFIX.  It's
already got both backslashes by the time _main_complete starts calling
the completers.  A quick peek at callcompfunc() shows that the prefix
gets passed through multiquote() in all cases except math expressions.
Again it might be possible to do something different depending on the
quoting state, but in this case it'd have to be in the C code.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2002-04-14  5:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-13 20:16 Borsenkow Andrej
2002-04-13 20:23 ` Borsenkow Andrej
2002-04-14  5:03   ` Bart Schaefer [this message]
2002-04-16  7:59 ` Sven Wischnowsky

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=1020414050308.ZM7620@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=Andrej.Borsenkow@mow.siemens.ru \
    --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).