delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/02/16/01:20:19

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F144F3857827
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none)
header.from=SystematicSw.ab.ca
Authentication-Results: sourceware.org;
spf=none smtp.mailfrom=brian DOT inglis AT systematicsw DOT ab DOT ca
X-Authority-Analysis: v=2.4 cv=MaypB7zf c=1 sm=1 tr=0 ts=602b641a
a=kiZT5GMN3KAWqtYcXc+/4Q==:117 a=kiZT5GMN3KAWqtYcXc+/4Q==:17
a=IkcTkHD0fZMA:10 a=uYT-Tk0qkVT609LjNaIA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19
a=QEXdDO2ut3YA:10 a=nxFJi58FgSUA:10
To: cygwin AT cygwin DOT com
References: <CABPP8W9h=LzUGf=JP-2x3SjrBPh8NJuoRbXzRU94b-WfBt94yw AT mail DOT gmail DOT com>
<20210214174358 DOT f828f285a566846254c3c54a AT nifty DOT ne DOT jp>
<60298BB0 DOT 1070301 AT tlinx DOT org>
<20210215090543 DOT afa8fac6ebec42faa471a5c6 AT nifty DOT ne DOT jp>
<602B2B20 DOT 1030003 AT tlinx DOT org> <1d266c7d-4915-8ff9-069a-04c1f5226eab AT gmail DOT com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Organization: Systematic Software
Subject: Re: Cygwin doesn't handle SIGWINCH properly in Windows Terminal
Message-ID: <e51eecff-2831-9934-a702-ff604fcf3409@SystematicSw.ab.ca>
Date: Mon, 15 Feb 2021 23:20:08 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.7.1
MIME-Version: 1.0
In-Reply-To: <1d266c7d-4915-8ff9-069a-04c1f5226eab@gmail.com>
X-CMAE-Envelope: MS4xfPAM6IkG8bLEhesROcr+1DVDXBYszJlTZsEGntcF9m4p41PG7ivP19iQUKPEGpZQvz1z1Qmv5eti1HXPikGCIJ1UnMAA2ScMV45kZV/nZmJcwu99gm1i
ie/8Gy8dmxIe1lP1EuubAgYbGxi5U20CvS46irSH9i2m9zlaPwLwH9DrWm4lR2KZbg/BREHY/50yCYHmz862S9Krgf8wu5XLkTk=
X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, BODY_8BITS,
KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW,
RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE,
TXREP autolearn=no autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 11G6KIEV006327

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.]
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019