[Top][All Lists]

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

Re: [Bug-readline] Forwarding input from ncurses to readline

From: Ulf Magnusson
Subject: Re: [Bug-readline] Forwarding input from ncurses to readline
Date: Tue, 17 Feb 2015 22:25:59 +0100

On Tue, Feb 17, 2015 at 5:56 PM, Chet Ramey <address@hidden> wrote:
> On 2/17/15 8:20 AM, Ulf Magnusson wrote:
>> I currently have readline reading directly from the TTY. I think this
>> will get messy, so I want to handle input and other terminal
>> operations exclusively with ncurses (using e.g. getch()) and forward
>> the appropriate characters to readline. Is the following an okay
>> approach? Will it correctly handle e.g. timeouts?
> This approach should work, as long as you're replacing both the function
> to read input and the function that says whether input is available.
> You may wish to consider handling timeouts to differentiate between
> possibly-ambiguous key sequences.
> Chet

Is the following comment in terminal.c outdated by the way?

/* If we're being compiled as part of bash, set the environment
   variables $LINES and $COLUMNS to new values.  Otherwise, just
   do a pair of putenv () or setenv () calls. */
if (rl_change_environment)
  sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);

It doesn't seem to matter whether readline is compiled as part of bash.

The fact that readline sets LINES and COLUMNS by default had me
banging my head for a few hours, as that overrides any dynamic size
calculation done by ncurses' SIGWINCH handling, making it always use
the initial terminal size.


reply via email to

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