From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20400 invoked from network); 4 Aug 2021 07:03:09 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Aug 2021 07:03:09 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1628060589; b=Yz1dpRNDuRDxVn+vVSDOy3hiUL4mMQK9hzKBLB35GXvor+DvRiO2iq8JcjGxbL2Hj+J4FX8vbQ NiGLF9oNjV0W2Xnr1nxYbZjQgxJh8SsQjay3Yx0qkahzOE4Ns+hkn/KdEnssGtfr83FCu2fmHy o2Z74Z1xzOJU6UPYeB/fzYB+scW1EFuEqsGOKEmUFRK1Uavf6Pwm8DfkLN9cTsYf4BBxSG7kQK 0K9u2ij1Ky+rFLuhtOBBXrFikv3jaSG02rHLS3pnWQnnbzxMLIZ8Rwj9089DB1hb7V8yE3AQRl Amy8aB214QwX+0/G8hZLPts0HotBVdGZsCfkUgtxwA5cAg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f178.google.com) smtp.remote-ip=209.85.208.178; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1628060589; bh=iWI0k9/Ym97c63Kb0uKP9oUVZU7w3GuDR8zyDGVVHWA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=QnT5/5OUpew67bh+pqVu5j6cft3fg1EoN56wNbRe9O3KTiGVfHASk5b2pmObed2u6vHpJdBIg7 3YT8Wsx9pROWfjIsbpIFixwVNx0+QxJaMgSmakCAmOWcrqgq416IKFFh4R6rYQ7M37mSvZqSrS V+i8IaigbmO7UpLBrd4gHfzUU5RQS90S8GVZ0ZjN1zj1TK5e/EdAZV4wnXJjxIP1MHuAsXxSGC mqWEnpvWH2qKlG3CT1lK3pAHH+F1zjsM/BE7fW5C+ExZQ5Yz1NYGKqYuXNogpNZYnGpdcqvp77 Q3kAphvQ4TtF09d8l61imUwyljwJxFxghmoYUWWb36F7PQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=NoVOCHjSga7B5czztotwmoWSsozcug2FY89JmCBDkg8=; b=M2uOIItOsaEI5ZnR6Ki69Jc+/Y SOZboo2lrGLzWBd1R+Kep6vGAvXYpQzCpGwbEPpm8dNQKbRzCUWIFpoARbccJZXFLvBRBGyWe8i0B qRhBhM7bC/tmIqaUIi0fCF7fJDpVn8kRPmAZLdJJwo2TdEckT7LP8+Dgt46JueeOfKzwK7ApLRtEO IYt3hXVVJPxlxtPjkZPso8ioG8ZeYFARXSA7sx8fX10/DMTcOpkqszilwSJzGL2CT5YicMeGY/WYz /7xG3kJyAie7ftQo9wto658S4a+FW4SjBRTi+727bG5C7zLGmhU9SBY5CWZ7x32UOdRuTulLS98mH atlYL6ow==; Received: from authenticated user by zero.zsh.org with local id 1mBAvj-0000GW-2Y; Wed, 04 Aug 2021 07:03:07 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f178.google.com) smtp.remote-ip=209.85.208.178; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f178.google.com ([209.85.208.178]:41823) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mBAlU-000PIV-3F; Wed, 04 Aug 2021 06:52:32 +0000 Received: by mail-lj1-f178.google.com with SMTP id h9so1383549ljq.8; Tue, 03 Aug 2021 23:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=NoVOCHjSga7B5czztotwmoWSsozcug2FY89JmCBDkg8=; b=Gi3PxhweL03PtEe1El4R+iQqP760s5Vmer3fo1dV4pl8u0+zKLbzUR1xo86Io4ue6q G+l56Wi5/pvZLyCqyHOpPYD2fIyTzyao78O2sW6lHXYygt1iDlmcba/dB/3P2Z0Lt9rA NUZSCPmMilPKpx3Q94ELDueulTjCzNOMTQJ3NxnQwrGpi3xbeUAliLhgbciduKhXK5Xf dUID8n0jPvcP3Xi8q6z766wgE+cDYB0hPH6+sfnqPK8iiTPWTaD9TH6vaKgoc56QGO5O h2PI89iUGcGIxfwuomfWxZzzkP3CCh+XMcdhMrkM7jnWI1G1pIwtK2oVuq9gUdFD0CdF A4bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=NoVOCHjSga7B5czztotwmoWSsozcug2FY89JmCBDkg8=; b=PvCRiXqVkWd5uwnxhSinsGuBrPNCzasDAkmTxQAgSLRO4cTdnl9Ls266BQEfd8hpjr hzBasY9CYuHYpQR8rIrlMhn/EEqIzWH8l0l3SmMqIv3MsWM0paLrIvK0ih+qh5XTsxZK MjCM0k3iX7dIM696+b7TsOfbPTQd/0rOYqMDypYNkA0rT2PH+ZE3sXAYCVGbhIDFHVFM ehTG1ixwUdWcxhxURddSRkttsZxNW3W5nurNq75wcnE9lnaY/9TSHl98vkqc2MP6/DD1 TBxRVo/g0xFL+i61+9iDhWSvwtUbBjO2Lg/wNDLnH6KXE92zYB7LdP2WwiFzmyqgAojL S52g== X-Gm-Message-State: AOAM531hHGpNpfAr2hrdMa7fmWC7j7EK2Mp+iRDgDS00yDum1hy+FYL3 x760AexSZG1dhRY4PiazDpYEQkVPAUBccLTmbNq/7Dk8oEE= X-Google-Smtp-Source: ABdhPJybIWKxWcWuRuWhNwiDpue+E4TPLJhI2eyW4bdcGDQFS4lB1fjgfbzptXRL9m7yzB+9tELvUwhfrsf92UAaE3w= X-Received: by 2002:a2e:a80f:: with SMTP id l15mr17611712ljq.354.1628059951078; Tue, 03 Aug 2021 23:52:31 -0700 (PDT) MIME-Version: 1.0 References: <549459d9-eee8-43b2-b8c6-71c11291f012@www.fastmail.com> In-Reply-To: <549459d9-eee8-43b2-b8c6-71c11291f012@www.fastmail.com> From: Marlon Richert Date: Wed, 4 Aug 2021 09:51:54 +0300 Message-ID: Subject: Re: [PATCH] Increase $COLUMNS when generating long option completions To: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= Cc: Bart Schaefer , Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 49237 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Wed, Aug 4, 2021 at 4:12 AM Lawrence Vel=C3=A1zquez wro= te: > > On Tue, Aug 3, 2021, at 10:05 AM, Marlon Richert wrote: > > On Mon, Aug 2, 2021 at 2:07 AM Bart Schaefer 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=3D read -r opt; do > > > > 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. The pipe is a red herring. > > > 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 )" > > Seems like pip is behaving differently depending on whether it's > outputting to a tty or not. I feel that cannot be the whole story, because if I do any of the following, I get terminal-width output, instead of 80 columns: % COLUMNS=3D$COLUMNS pip3 --help | cat % print -r -- "$( COLUMNS=3D$COLUMNS pip3 --help )" % _call_program tst COLUMNS=3D$COLUMNS pip3 --help | cat And pip isn't the only command that works that way. For example: % ls -x / Applications Library System Users Volumes bin cores dev etc home opt private sbin tmp usr var % ls -x / | cat Applications Library System Users Volumes bin cores dev etc home opt private sbin tmp usr var % COLUMNS=3D$COLUMNS ls -x / | cat Applications Library System Users Volumes bin cores dev etc home opt private sbin tmp usr var %