bug-bash
[Top][All Lists]
Advanced

[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 <address@hidden> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]