[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: winch trap delayed until keypress
From: |
Pierre Gaston |
Subject: |
Re: winch trap delayed until keypress |
Date: |
Thu, 22 May 2014 15:49:49 +0300 |
On Thu, May 22, 2014 at 8:16 AM, Linda Walsh <bash@tlinx.org> wrote:
>
>
> Chet Ramey wrote:
>
>> On 5/20/14, 8:28 AM, Egmont Koblinger wrote:
>>
>>> Hi,
>>>
>>> Execute this in an interactive bash and then resize the window:
>>> trap 'stty size' winch
>>>
>>> In bash-4.2, the trap was executed immediately upon resize. In
>>> bash-4.3, it is delayed until the next keypress.
>>>
>>
>> http://lists.gnu.org/archive/html/bug-readline/2014-05/msg00005.html
>>
> ---
> And if the window is just displaying something -- running a shell script,
> when will it get the resize event so it can update it's display?
>
> I.e. a window resize can easily happen when no key press is in sight,
> Seems like deferring it and at least calling it off a timer.
>
> But it sounds like my winch handler that would tell me the size of
> a resized screen will now be broken.
>
> The whole point was to resize and it would update and tell you the size
> when you finished moving. If you have to wait to type keys each time, that
> sorta defeats the point.
>
> The previous version said this (checkwinsize):
> If set, bash checks the window size after each command
> and, if necessary, updates the values of LINES and COLUMNS.
>
> Wasn't checking the window size after each command safe?
>
> It may not be the same as a key press, but it is alot more likely to
> occur -- running a script or running interactively.
>
>
> As I understand it, this is now broken in 4.3?:
> ----
> # display new size of terminal when resized
> function showsize () {\
> local s=$(stty size); local o="(${s% *}x${s#* })"; s="${#o}";\
> echo -n $o; while ((s-- > 0));do echo -ne "\b"; done; \
> }
>
> trap showsize SIGWINCH
> ----
>
As I understand it, it only affects the interactive behaviour of bash, and
doesn't change anything for your use case, the trap will be executed when
the foreground command exits.
- winch trap delayed until keypress, Egmont Koblinger, 2014/05/20
- Re: winch trap delayed until keypress, Chet Ramey, 2014/05/20
- Re: winch trap delayed until keypress, Linda Walsh, 2014/05/22
- Re: winch trap delayed until keypress,
Pierre Gaston <=
- Re: winch trap delayed until keypress, Linda Walsh, 2014/05/22
- Re: winch trap delayed until keypress, Pierre Gaston, 2014/05/22
- Re: winch trap delayed until keypress, Greg Wooledge, 2014/05/22
- Re: terminal emulators and size displays used when running bash (OB-tie-in) ; -) (was: Re: winch trap delayed until keypress), Linda Walsh, 2014/05/22
- Re: terminal emulators and size displays used when running bash (OB-tie-in) ; -), Chet Ramey, 2014/05/23
- Re: terminal emulators and size displays used when running bash (OB-tie-in) ; -), Linda Walsh, 2014/05/23
- Re: winch trap delayed until keypress, Chet Ramey, 2014/05/22
- Re: winch trap delayed until keypress, Linda Walsh, 2014/05/22
- Re: winch trap delayed until keypress, Egmont Koblinger, 2014/05/22
- Re: winch trap delayed until keypress, Linda Walsh, 2014/05/22