X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F286B3971838
Authentication-Results: sourceware.org;
 dmarc=none (p=none dis=none) header.from=towo.net
Authentication-Results: sourceware.org; spf=none smtp.mailfrom=towo@towo.net
Subject: Re: Cygwin doesn't handle SIGWINCH properly in Windows Terminal
To: cygwin@cygwin.com
References: <CABPP8W9h=LzUGf=JP-2x3SjrBPh8NJuoRbXzRU94b-WfBt94yw@mail.gmail.com>
 <20210214174358.f828f285a566846254c3c54a@nifty.ne.jp>
 <60298BB0.1070301@tlinx.org>
 <20210215090543.afa8fac6ebec42faa471a5c6@nifty.ne.jp>
 <602B2B20.1030003@tlinx.org> <1d266c7d-4915-8ff9-069a-04c1f5226eab@gmail.com>
 <e51eecff-2831-9934-a702-ff604fcf3409@SystematicSw.ab.ca>
 <92a91e86-780f-e0de-8db2-04e89af3f7d7@towo.net>
From: Thomas Wolff <towo@towo.net>
Message-ID: <87e0eca8-718d-f551-cc6c-464392e5dc5f@towo.net>
Date: Tue, 16 Feb 2021 11:38:47 +0100
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: <92a91e86-780f-e0de-8db2-04e89af3f7d7@towo.net>
X-Provags-ID: V03:K1:Gk42gw1pkLBL/I/J1b6qC1t33Z8DBekq7jw+cAkcnn/mEMwzLe3
 KpjYgWroorO77PzDWFsNXd6n1gSD6hDwxof+Pmvnt8msJzn3UPBFBVU5Dz2pKFNz8l7KEHW
 xa7KNnTc5W/S1uwvCVdItW68Uy8KuNk4LcY/JTCAlzj1UiDz+CiynyJ9bQTFLBdUZ69MDkK
 01ZuMgBMQXMIdmrBuBl3Q==
X-UI-Out-Filterresults: notjunk:1;V03:K0:soGdgbcaoN8=:ocRfug1MfK4bxkauecMVhh
 /PV/CKnoz6celOwq8+4B0ammbTDEOkFRkmKcQ2LBgn/1KhoEzX/g+wZ5HsVeqHKbNOMZRJyCL
 eVjQox03dCuesYAkZN1UHWbVLoYTwYwcyDs4xUgg5mU3jKSs61NLKu0Tg53G+qmC6LTcNd9A3
 7lS3ztuYmXBHmsHYLRPOwuu/OpPYNiKDHDnKN9QhiNnz/s/QZsu8PCsVXxPwyoOBPK+xWvMkS
 KQQEdxKPWuQhlfqTu4i6w/cKFtlbokjQ8gYLsU8GRTZAPrdBbHsQF3vjEvYGe5q74jSfJ4MNe
 1ogwCEHTI24RgkIcY6/aEzYgw+c/q4uSARMF0XArHPzID501+B42hDeeh9cGi+5cY212PcCjx
 3ma/voC+RBJxVlVgUkvMhzBiQHQqjKve0q1XDNXsO6Rcre6eV6DsXuEt3iQ5/
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00, BODY_8BITS,
 KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
 RCVD_IN_MSPIKE_H2, 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@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces@cygwin.com
Sender: "Cygwin" <cygwin-bounces@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 11GAcmqR015842

Am 16.02.2021 um 11:26 schrieb Thomas Wolff:
>
> Am 16.02.2021 um 07:20 schrieb Brian Inglis:
>> 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
> I have a similar trap in my .bashrc and it's being triggered when 
> running bash from either cmd (conhost) or Windows Terminal and 
> resizing them. Did I miss something in this issue?
Yes I did. Sorry for the fuss.
>
>>
>>>>> 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.
>>
>
> -- 
> 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

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

