zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Heinz Deinhart <emperor@ei.ml.org>
Cc: zsh-users@math.gatech.edu
Subject: Re: completion & read, vared
Date: Mon, 13 Jul 1998 18:45:10 -0700	[thread overview]
Message-ID: <980713184510.ZM3653@candle.brasslantern.com> (raw)
In-Reply-To: <Pine.LNX.3.96.980713200430.4708A-100000@ei.ml.org>

On Jul 13,  8:19pm, Heinz Deinhart wrote:
> Subject: Re: completion & read, vared
> 
> 
> On Mon, 13 Jul 1998, Bart Schaefer wrote:
> 
> > On Jul 13,  1:10pm, Heinz Deinhart wrote:
> > } Subject: completion & read, vared
> > }
> > }  is there a way to use completion with any realine-like function ?
> > 
> > Not directly; "read" inputs characters one at a time, for some reason,
> > even when not in raw mode.
> 
> hmm, maybe i'm missing something, but

No, it is I that missed something.

You meant "... use completion with _every_ readline-like function?"

I parsed "... use completion with one of the readline-like functions?"

The answer to the former question is, no, there isn't.

The answer I gave was to invent a readline-like function that uses vared
to perform completion, which may be interesting but isn't what you wanted.

> > } vared uses completion, but i cant figure out how to change its behaviour.
> > 
> > Change its behavior how?
> 
> it would be cool if vared had a completion option (maybe -C) 
> 
> "vared -p 'enter a username> ' -C '-u' returnvar"
> "emp<TAB>" expands to "emperor"
> 
>                                   ^^^^ the compctl options that vared
>                                        should use in input-line

Completion within vared appears to work exactly as if it were parsing a
command line; e.g. it completes commands in the leftmost word, then does
the completions for those commands in succeeding words, etc.  Arguably
this isn't the most useful behavior.  (For more fun, try invoking the
binding for run-help while you're doing a vared; the results are not very
helpful).

To get the effect that you specifically asked for above, you need to change
the default completion by using "compctl -T", then restore the default when
vared has exited.  E.g.,

	compctl -Tx 'W[0,*]' -u
	vared whatever
	compctl -T

As usual, one can't attempt something like this without running into another
zsh oddity.  In this case,

	compctl -T -u

is accepted and appears in the "compctl -L" output, but is a no-op.  There
has to be a -x option and a pattern before -T will do anything at all.  The
manual says -T "is only useful when combined with extended completion" but
here's a case where (a) it's useful WITHOUT extended completion and (b) it
fails mysteriously when used in the obvious way.

We should strive to prevent this sort of thing.

Anyway, 'W[0,*]' means accept anything in word zero (the command position)
which is the closest you can get to having no pattern at all.


      reply	other threads:[~1998-07-14  1:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-13 11:10 Heinz Deinhart
1998-07-13 17:37 ` Bart Schaefer
1998-07-13 18:19   ` Heinz Deinhart
1998-07-14  1:45     ` Bart Schaefer [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=980713184510.ZM3653@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=emperor@ei.ml.org \
    --cc=zsh-users@math.gatech.edu \
    /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).