help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: stty size doesn't work
Date: Mon, 24 Oct 2022 00:21:13 +0200	[thread overview]
Message-ID: <CAN=4vMrJ6y48-XOZRCpxnX6DEfUBQf25wzoscqGnwq+0ViLcTQ@mail.gmail.com> (raw)
In-Reply-To: <80a69953-a19c-f5c3-17fb-747633527712@eastlink.ca>

On Sun, Oct 23, 2022 at 10:47 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
> I doubt this is zsh's problem but she may have a solution just the same.  I do this in my 'i' function:
>     width=${=$( stty size )[2]}
> ... and it works fine, however if I call the function thusly:
> _function_test ()
> {
>     local integer i=0
>     while read aa; do
>         let i++
>         eval ${=aa} 2> /dev/null
>     done
> }
>     $ _function_test <<< "i path"
> ... 'width' is zero.

`stty size` needs the TTY as stdin. When you are invoking it from
_function_test, stdin is not a TTY. Use $COLUMNS instead. There is
also $LINES if you need height.



  reply	other threads:[~2022-10-23 22:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-23 20:47 Ray Andrews
2022-10-23 22:21 ` Roman Perepelitsa [this message]
2022-10-24  2:59   ` Ray Andrews

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN=4vMrJ6y48-XOZRCpxnX6DEfUBQf25wzoscqGnwq+0ViLcTQ@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \


* 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


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).