bug-readline
[Top][All Lists]
Advanced

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

Re: [Bug-readline] Readline backspacing bug(?) with null prompt (externa


From: Chet Ramey
Subject: Re: [Bug-readline] Readline backspacing bug(?) with null prompt (external prompt)
Date: Mon, 09 Jun 2014 16:19:52 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 6/5/14, 2:23 AM, Melnik Hoogland wrote:
> Hi folks,
> 
> We had a little program that we edited to use readline() instead of another
> input method, and left in our existing code to print out a prompt, and just
> called readline(NULL) (per this statment from the the manpage: "If prompt
> is NULL or the empty string, no prompt is issued.")  We found that in this
> case if we entered some text and then backspaced it, on the final backspace
> not only was the input erased, but also the (pre-printed) prompt. That is,
> when the initial input character was backspaced, readline was erasing all
> the way to the beginning of the line, beyond the input character that was
> being backspaced.

Readline's redisplay engine assumes that it has full control of the input
line.  It's fairly sophisticated in its attempts to use everything the
terminal has to offer and to minimize the number of characters written as
part of redisplay.  To that end, it will, on occasion, move the cursor to
column 0, redraw the prompt, and clear to the end of line (which most
terminals can do efficiently) as part of redisplay.

There's no way to tell readline that it is not starting in column 0, and
no way to tell it to ignore any text existing on the line.  That might be
a hole in functionality, but it's not one that is requested often.

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/



reply via email to

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