[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: winch trap delayed until keypress

From: Linda Walsh
Subject: Re: winch trap delayed until keypress
Date: Wed, 21 May 2014 22:16:07 -0700
User-agent: Thunderbird

Chet Ramey wrote:
On 5/20/14, 8:28 AM, Egmont Koblinger wrote:

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.

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

reply via email to

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