On 2/18/15 9:43 PM, Ulf Magnusson wrote:

> Re. rl_change_environment, there's this in the source:
> 
> /* If this is non-zero, readline will set LINES and COLUMNS in the
>    environment when it handles SIGWINCH. */
> int rl_change_environment = 1;
> 
> However, afaics readline does not update LINES and COLUMNS in the
> SIGWINCH handler, at least not in the non-bash case. Is there some
> motivation for this (besides being a bit tricky due to putenv/setenv not being
> async-signal-safe)? The comment seems a little misleading either way. :)

It does.  The SIGWINCH handler just sets a flag (_rl_caught_signal) and, as
a side effect, calls any application-specific SIGWINCH handler to allow it
to do the same.  When readline does its signal handling via the
RL_CHECK_SIGNALS macro, it notices that it caught SIGWINCH and calls
_rl_signal_handler with SIGWINCH as the argument.  _rl_signal_handler
calls rl_resize_terminal, which calls _rl_get_screen_size, which eventually
calls sh_set_lines_and_columns.

There is a weakness in this implementation in that it only handles the
last received signal, but it has not proved to be a problem yet.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    [email protected]    http://cnswww.cns.cwru.edu/~chet/

_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to