zsh-workers
 help / color / mirror / Atom feed
* [BUG] _less incorrectly completes -" and -#
@ 2020-10-01 12:11 Roman Perepelitsa
  2020-10-02 14:47 ` Oliver Kiddle
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Perepelitsa @ 2020-10-01 12:11 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

Completing `less -` offers `-"` as a candidate. Accepting it literally
inserts `-"`. I think it should offer `-\"` and insert the same.

My naive patch (posted below) fixes this issue but not completely.
Unexpected behavior with the patch:

  - Completing `less -\" x -` doesn't list any flags.
  - Completing `less --quote=x -` lists `-\"`.

I was unable to fix these.

Roman.

P.S.

`-#` has the same issue.

---

[-- Attachment #2: patch-less.txt --]
[-- Type: text/plain, Size: 875 bytes --]

diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less
index cb71314a6..cdb3c0e56 100644
--- a/Completion/Unix/Command/_less
+++ b/Completion/Unix/Command/_less
@@ -80,7 +80,7 @@ _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" \
   '--follow-name[the F command changes file if the input file is renamed]' \

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] _less incorrectly completes -" and -#
  2020-10-01 12:11 [BUG] _less incorrectly completes -" and -# Roman Perepelitsa
@ 2020-10-02 14:47 ` Oliver Kiddle
  2020-10-07  0:44   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2020-10-02 14:47 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: Zsh hackers list

Roman Perepelitsa wrote:
> Completing `less -` offers `-"` as a candidate. Accepting it literally
> inserts `-"`. I think it should offer `-\"` and insert the same.
>
> My naive patch (posted below) fixes this issue but not completely.

It also breaks them for the case where the user has specified an initial
single or double quote.

The real problem is that from inside _arguments, the -Q option gets
passed to compadd. Removing it is a fairly easy change. But I wish I
knew why it was used in the first place. Maybe we should just do that
and worry later about fixing any problems it creates afterwards.

It really seems ugly to be quoting any options in the _arguments
specifications other than those that are special to _arguments itself (=
: [ and +)

Oliver


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] _less incorrectly completes -" and -#
  2020-10-02 14:47 ` Oliver Kiddle
@ 2020-10-07  0:44   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2020-10-07  0:44 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: Roman Perepelitsa, Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 582 bytes --]

On Fri, Oct 2, 2020 at 7:47 AM Oliver Kiddle <opk@zsh.org> wrote:

>
> The real problem is that from inside _arguments, the -Q option gets
> passed to compadd. Removing it is a fairly easy change. But I wish I
> knew why it was used in the first place.


The first use of -Q in _arguments happened sometime between workers/7450
and workers/10309, which (unfortunately for quick back-tracing) were all
slurped in as a single commit by PWS when we first migrated to git.  At
that point Sven was still doing 99% of the edits to completion and his
entries in ChangeLog are a bit terse.

[-- Attachment #2: Type: text/html, Size: 878 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-07  0:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 12:11 [BUG] _less incorrectly completes -" and -# Roman Perepelitsa
2020-10-02 14:47 ` Oliver Kiddle
2020-10-07  0:44   ` Bart Schaefer

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git