public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: Cygwin doesn't handle SIGWINCH properly in Windows Terminal
Date: Mon, 15 Feb 2021 23:20:08 -0700	[thread overview]
Message-ID: <e51eecff-2831-9934-a702-ff604fcf3409@SystematicSw.ab.ca> (raw)
In-Reply-To: <1d266c7d-4915-8ff9-069a-04c1f5226eab@gmail.com>

On 2021-02-15 22:48, Marco Atzeri via Cygwin wrote:
> On 16.02.2021 03:17, L A Walsh wrote:
>> On 2021/02/14 16:05, Takashi Yano wrote:
>>> On Sun, 14 Feb 2021 12:44:32 -0800
>>> L A Walsh wrote:
>>>> showsize () {\
>>>>   declare s=$(stty size); s="(${s// /x})"  ;\
>>>>   printf "%s" "$s${s//?/$'\b'}"       ;\
>>>> }; export -f showsize
>>>>
>>>> trap showsize SIGWINCH

>>> What do you mean by "reset LINES/COLUMNS"? I am not sure what
>>> is the behaviour diffrence in Linux and cygwin you mentioned.

>>      Actually not sure I can reproduce this now.  The only
>> thing I am noticing is that if bash is attached to /dev/pts3
>> (as in mintty), it works, but if attached to /dev/cons0 (as in
>> cmd.exe), nothing works as no signal is propagated from
>> the window resize to running program.
>>
>>      AFAIK, though, that's always been one of multiple probs in using windows 
>> cmd with a bash shell.

> maybe this is waht you are looking for:
> 
> # This causes bash to check the terminal size after every command
> # and adjusts $LINES and $COLUMNS to the correct values.
> shopt -s checkwinsize

Newer bash man pages say this is the default; set in my .bashrc so I can't tell; 
bash man pages also say COLUNS and LINES are set on SIGWINCH if interactive:

$ man bash | egrep -A1 'COLUMNS|LINES|checkwinsize'
COLUMNS	
	Used by the select compound command to determine the terminal width when
	printing selection lists. Automatically set if the checkwinsize option
	is enabled or in an interactive shell upon receipt of a SIGWINCH.
--
LINES	Used by the select compound command to determine the column length for
	printing selection lists. Automatically set if the checkwinsize option
	is enabled or in an interactive shell upon receipt of a SIGWINCH.
--
checkwinsize
	If set, bash checks the window size after each command and, if
	necessary, updates the values of LINES and COLUMNS.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

  reply	other threads:[~2021-02-16  6:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-13 10:39 Alvin Seville
2021-02-13 17:38 ` Brian Inglis
2021-02-14  8:43 ` Takashi Yano
2021-02-14 20:44   ` L A Walsh
2021-02-15  0:05     ` Takashi Yano
2021-02-16  2:17       ` L A Walsh
2021-02-16  5:48         ` Marco Atzeri
2021-02-16  6:20           ` Brian Inglis [this message]
2021-02-16 10:26             ` Thomas Wolff
2021-02-16 10:38               ` Thomas Wolff
2021-02-16 21:55               ` L A Walsh
2021-02-15  0:21     ` Takashi Yano
2021-02-16 10:31   ` Takashi Yano
2021-02-16 11:31     ` Takashi Yano
2021-02-16 16:26       ` Brian Inglis
2021-02-16 20:37         ` Takashi Yano
2021-02-16 20:50           ` Thomas Wolff
2021-02-16 22:11             ` Brian Inglis

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=e51eecff-2831-9934-a702-ff604fcf3409@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin@cygwin.com \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).