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

Re: [PATCH] Increase $COLUMNS when generating long option completions

On Tue, Aug 3, 2021 at 6:12 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
> On Tue, Aug 3, 2021, at 10:05 AM, Marlon Richert wrote:
> >
> > No, the problem results from _call_program being connected to a pipe:
> >
> > When ${~words[1]} is an external command, it will then not see
> > $COLUMNS, unless $COLUMNS has been exported.
> Isn't that the case in general?  External commands *never* see
> COLUMNS if it isn't in the environment.

I was thinking the same thing.

> The pipe is a red herring.

Well, not exactly. As you said:

> Seems like pip is behaving differently depending on whether it's
> outputting to a tty or not.

Probably, if the output is a tty then when it finds no $COLUMNS, it
reads the width from the tty, and when it has neither it falls back to

Still that would argue for using
... COLUMNS=$COLUMNS ${~words[1]} ...
That is, export an accurate value rather than an arbitrarily large one.

The next question would be, is _arguments the only place this is
useful?  Or would it be better  if _call_program always did so? E.g.
  local -x COLUMNS

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