Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

How to get prefix with quotes in completion widgets?



Hi,

How do I get access to a version of $PREFIX which includes the quotes within a completion widget?

eg. If I have a completion widget for example which prints the following:

	echo "il:$words:"
	echo "ll:$words[1,CURRENT-1]:"
	echo "pr:$PREFIX:"
	echo "ip:$IPREFIX:"
	echo "qi:$QIPREFIX:"
	echo "aq:$compstate[all_quotes]:"

And then I enter the line:

example insert ( 'foo', 'bar' )
                        ^^^
                        123

And complete on the three successive characters shown, I get:

1:
	il:example insert ( 'foo', 'bar' ):
	ll:example insert:
	pr:(\ foo,\ :
	ip::
	qi::
	aq:\:
2:
	il:example insert ( 'foo', 'bar' ):
	ll:example insert:
	pr:(\ foo,\ :
	ip::
	qi::
	aq:\:
3:
	il:example insert ( 'foo', 'bar' ):
	ll:example insert:
	pr:(\ foo,\ b:
	ip::
	qi::
	aq:\:

Here PREFIX has lost the ' which are present in words[CURRENT]. Is there a way to access a version of PREFIX which has not been so altered? Or alternatively, is there a way of getting the character position of the cursor inside words[CURRENT] so that I could use that?

I note especially that although the cursor is in a different position for 1 & 2 (1: outside the quote, 2: inside the quote), there is no difference in the information available at completion time that I can see.

Cheers,

Martin.

This message is for the named person's use only. It may contain sensitive and private proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you are not the intended recipient, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. CREDIT SUISSE GROUP and each legal entity in the CREDIT SUISSE FIRST BOSTON or CREDIT SUISSE ASSET MANAGEMENT business units of CREDIT SUISSE FIRST BOSTON reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity.
Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as  preliminary only and subject to our formal written confirmation.




Messages sorted by: Reverse Date, Date, Thread, Author