On Fri, Feb 20, 2015 at 3:27 AM, Chet Ramey <[email protected]> wrote:
> 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.
>

Hmm... it's odd that ncurses doesn't pick up the updated LINES and COLUMNS
variables then. It also forwards the signal in its SIGWINCH handler.

Might look into it some more later.

/Ulf

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

Reply via email to