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 A7BEC3857C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=towo.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=towo AT towo DOT net Subject: Re: Cygwin doesn't handle SIGWINCH properly in Windows Terminal To: cygwin AT cygwin DOT com References: <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: Thomas Wolff Message-ID: <92a91e86-780f-e0de-8db2-04e89af3f7d7@towo.net> Date: Tue, 16 Feb 2021 11:26:38 +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: X-Provags-ID: V03:K1:lPxnxCDrhXskcqd7dTftY2YazqPQlBeN0m9lI5wkXJwA7oAsS3V vUJ9AYEag40MCdSrDKU6CSAjDKlnypHeEydw8iQPpO8WRl2eSBW/Jo4CD+Z45puCmEakmVO JlLVnIgkYApvEmUQjX6ogmsYoDJloC+H1vZ/L1h2ZyeGW6KFKFDz3BprX8iFuA4/zJL/Hb2 cVjnILUPxsec5xFRmgnEQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:kEKdQ7dRzaQ=:Bm01gmPm8dQGw98Of0WpBk Kds5+LNnc4F2j50hqov/+pR2ESElsoNhdvKdNWOK3oiReTiCZPFH52Mxd4wU35Or1PMll7uAy +vobI0MeRlsWzQAsi5bdk57nCdhNPpEDAXLnHCmdhlvW4DjaVdep0dkt2jxxtgodQkeCsJ124 meerY9M1oYwpqy+o0Nn5HdquvNQgcoCFZjbMyQcS7t/A71Xvf43oJ5Q69fMbvKScUaQQqvtWL l+saJkS5dYZ3H6JCEw2/AV4Ib4DTILERr8visCipMPtELY6jQEML9pYsh8/H78MlhsWsfFMmg OS/iU8przXZo5U92Q3D0AxA7l1UO0s0/doOUv4d8Dp8xMbtO7l73EeTm9XQSEYMtrOblr1koG 1A2apMvZ4kQ9W0TtIwyR85PgoXehHg2Sv+BbDQYM7Wm1JwM1FtBvGzoql6SZA 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 AT cygwin DOT 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: , Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 11GAQeeq013943 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? > >>>> 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