[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-readline] Forwarding input from ncurses to readline
From: |
Chet Ramey |
Subject: |
Re: [Bug-readline] Forwarding input from ncurses to readline |
Date: |
Thu, 19 Feb 2015 21:27:43 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
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 address@hidden http://cnswww.cns.cwru.edu/~chet/
- [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/17
- Re: [Bug-readline] Forwarding input from ncurses to readline, Chet Ramey, 2015/02/17
- Re: [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/17
- Re: [Bug-readline] Forwarding input from ncurses to readline, Chet Ramey, 2015/02/17
- Re: [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/17
- Re: [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/18
- Re: [Bug-readline] Forwarding input from ncurses to readline,
Chet Ramey <=
- Re: [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/20
- Re: [Bug-readline] Forwarding input from ncurses to readline, Chet Ramey, 2015/02/20
- Re: [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/20
- Re: [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/20
- Re: [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/20
- Re: [Bug-readline] Forwarding input from ncurses to readline, Chet Ramey, 2015/02/21
- Re: [Bug-readline] Forwarding input from ncurses to readline, Ulf Magnusson, 2015/02/21
- Re: [Bug-readline] Forwarding input from ncurses to readline, Chet Ramey, 2015/02/22