zsh-workers
 help / color / mirror / code / Atom feed
From: Marlon Richert <marlon.richert@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [BUG] Incorrect usage of $PREFIX and $SUFFIX in completion functions
Date: Tue, 9 Apr 2024 10:27:45 +0300	[thread overview]
Message-ID: <CAHLkEDvOWRUzDka4XAQf1rue8YhrtEbAQsth2V7FR9+n0NRSJA@mail.gmail.com> (raw)

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

Many completion functions in the Zsh code base use $PREFIX$SUFFIX to get
the word to complete on the command line. However, this seems incorrect to
me, because it prevents the _prefix completer from functioning correctly
for those completion functions.

Shouldn't all completion functions simply use $PREFIX to get the word to
complete, since it is the responsibility of the completer function
(_complete, _prefix, etc.) to decide whether the character to the right
should be considered part of the word to be completed?

Shouldn't _complete do `PREFIX+=$SUFFIX; SUFFIX=` before calling completion
functions, since, otherwise, there is no meaningful difference between it
and _prefix?

Additionally, if _complete should indeed do `PREFIX+=$SUFFIX; SUFFIX=`,
then shouldn't compinit always enable COMPLETE_IN_WORD, since, without it,
_prefix is not able to function correctly and _complete should behave the
same regardless?

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

             reply	other threads:[~2024-04-09  7:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09  7:27 Marlon Richert [this message]
2024-04-09  9:14 ` Oliver Kiddle

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=CAHLkEDvOWRUzDka4XAQf1rue8YhrtEbAQsth2V7FR9+n0NRSJA@mail.gmail.com \
    --to=marlon.richert@gmail.com \
    --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).