From: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: [BUG] _less incorrectly completes -" and -#
Date: Mon, 21 Feb 2022 22:36:37 +0900 [thread overview]
Message-ID: <4584088F-C715-491D-BC24-3916C7A22662@kba.biglobe.ne.jp> (raw)
In-Reply-To: <59878-1634948764.966966@18Tx.APRj.e74Z>
This is the minor problem I mentioned in the previous post (49765).
> 2021/10/23 9:26, Oliver Kiddle <opk@zsh.org> wrote:
>
> This is digging up another fairly old _arguments issue that I meant to
> deal with before:
>
> On 2 Oct 2020, I wrote:
>> Roman Perepelitsa wrote:
>>> Completing `less -` offers `-"` as a candidate. Accepting it literally
>>> inserts `-"`. I think it should offer `-\"` and insert the same.
The patch (commit 4e9d00) has solved this problem, but a few problems remain.
zsh[1]% less -\"<TAB><TAB>
The 1st TAB inserts a space, and the 2nd TAB offers list of input files,
but what is expected is a message "quoting characters".
zsh[2]% less -\"cc -<TAB>
this still offers --quote and -"
zsh[3]% less -\" cc -<TAB>
this gives "No match for: 'file'"
Since ca_parse_line() (computil.c:2009) does not remove the escape from the -\"
on the command line (see line 2080 and below), it seems it is not recognized as
a known option.
If I quote the -\"+ in the spec as '-\"+'
'(-" --quotes)'{'-\"+',--quotes=}'[change quoting character]:quoting characters'
then the above problems seem to be "mostly" solved
(in case [1], for the 1st TAB we also get
-" -- change quoting character
in addition to the correct message).
But with this spec:
zsh[4]% less --quote=cc -<TAB>
this still offers -"
It seems we also need to escape the " in the exclusion list:
'(-\" --quotes)'{'-\"+',--quotes=}'[change quoting character]:quoting characters'
but is this a good way of fixing these problems?
(this patch is against the current master, not including the patch in 49765).
diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less
index ae912a633..7ba665069 100644
--- a/Completion/Unix/Command/_less
+++ b/Completion/Unix/Command/_less
@@ -80,9 +80,9 @@ _arguments -S -s -A "[-+]*" \
'--no-keypad[disable use of keypad terminal init string]' \
'(-y --max-forw-scroll)'{-y,--max-forw-scroll}'[specify forward scroll limit]' \
'(-z --window)'{-z+,--window=}'[specify scrolling window size]:lines' \
- '(-" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \
+ '(-\" --quotes)'{'-\"+',--quotes=}'[change quoting character]:quoting characters' \
'(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \
- '(-# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \
+ '(-\# --shift)'{'-\#+',--shift=}"[specify amount to move when scrolling horizontally]:number" \
'--file-size[automatically determine the size of the input file]' \
'--incsearch[search file as each pattern character is typed in]' \
'--line-num-width=[set the width of line number field]:width [7]' \
prev parent reply other threads:[~2022-02-21 13:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 12:11 Roman Perepelitsa
2020-10-02 14:47 ` Oliver Kiddle
2020-10-07 0:44 ` Bart Schaefer
2021-10-23 0:26 ` Oliver Kiddle
2022-02-21 13:36 ` Jun. T [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=4584088F-C715-491D-BC24-3916C7A22662@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.org \
/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).