Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Increase $COLUMNS when generating long option completions
- X-seq: zsh-workers 49231
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Increase $COLUMNS when generating long option completions
- Date: Tue, 3 Aug 2021 17:05:07 +0300
- Archived-at: <https://zsh.org/workers/49231>
- In-reply-to: <CAH+w=7ZPaOteZea0zBkm6b7GUMTJPdyd=yAuh1wGxeYcf3mmtg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHLkEDthKahBTBD5V1nuGA3WV43c4EPwV7zb-yrx8AVLSkohJQ@mail.gmail.com> <CAH+w=7ZPaOteZea0zBkm6b7GUMTJPdyd=yAuh1wGxeYcf3mmtg@mail.gmail.com>
On Mon, Aug 2, 2021 at 2:07 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> I'm puzzled, doesn't this imply that the value of $COLUMNS is
> incorrect on entry to the function?
No, the problem results from _call_program being connected to a pipe:
_call_program $lflag options ${~words[1]} --help 2>&1 |
while IFS= read -r opt; do
When ${~words[1]} is an external command, it will then not see
$COLUMNS, unless $COLUMNS has been exported.
For example, compare the output of the following:
% pip3 --help
% _call_program tst pip3 --help
% _call_program tst pip3 --help | cat
% print -r -- "$( pip3 --help )"
The first two will produce output that is as wide as the terminal,
whereas the latter two will always produce 80 columns of output.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author