Cygwin doesn't handle SIGWINCH properly in Windows Terminal

Thomas Wolff towo@towo.net
Tue Feb 16 10:38:47 GMT 2021


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



More information about the Cygwin mailing list