From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) by sourceware.org (Postfix) with ESMTPS id F144F3857827 for ; Tue, 16 Feb 2021 06:20:11 +0000 (GMT) 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.inglis@systematicsw.ab.ca Received: from [192.168.1.104] ([24.64.172.44]) by shaw.ca with ESMTP id BtiTl3E5EHmS3BtiUlN5uV; Mon, 15 Feb 2021 23:20:10 -0700 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 Reply-To: cygwin@cygwin.com To: cygwin@cygwin.com References: <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> From: Brian Inglis Organization: Systematic Software Subject: Re: Cygwin doesn't handle SIGWINCH properly in Windows Terminal Message-ID: 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> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 8bit 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@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 06:20:13 -0000 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.]