bug-readline
[Top][All Lists]
Advanced

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

Re: rl_already_prompted changed in version 8.1


From: Chet Ramey
Subject: Re: rl_already_prompted changed in version 8.1
Date: Mon, 17 Oct 2022 15:12:46 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.3

On 10/17/22 12:46 PM, Laszlo Csirmaz wrote:
That's the point:
It probably `worked' in readline-7.0 because readline didn't happen to reprint 
the prompt when it was doing redisplay.
Why should it reprint the prompt in this case?

It doesn't matter. Readline redisplay is a black box - anything goes as
long as the results are correct. If it thinks that the best way to do an
update is to move back to the end of the prompt and redisplay the line,
then it can do that.

The issue is that printing a prompt that you *don't* use as the prompt
string passed to readline, then setting rl_already_prompted, violates one
of the requirements for its use. That means that readline's idea of the
physical line is wrong about contents and length, and it has the wrong
idea of where the cursor is on the line.

You can see how these two things can combine to scramble the screen
contents if the prompt you pass to readline() is shorter than what you
actually print on the screen before setting rl_already_prompted.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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