bug-bash
[Top][All Lists]
Advanced

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

Re: exiting i-search using end-of-line on multi-line prompt in multi-byt


From: Chet Ramey
Subject: Re: exiting i-search using end-of-line on multi-line prompt in multi-byte locale
Date: Wed, 15 Mar 2017 10:16:03 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 3/12/17 6:57 PM, Grisha Levit wrote:

> Also it seems that the prompt is re-drawn after the text?  For
> example, setting the prompt as:
> 
> PS1='\n\[\e[0m\e[K\]'
> 
> and repeating the above puts point in the middle of a blank line.

Readline redraws the prompt because in the general case it needs to
output all of the invisible characters to get things like the color
right.  The invisible characters are assumed to be non-destructive.
This is potentially inefficient, but not dangerous.

In the above scenario, readline makes sure the cursor is at column 0,
deletes the necessary 24 characters ("(reverse-i-search)`fo': ") using
the terminal's `DC' capability, leaving "echo foo" on the screen, then
redraws the prompt, since those are the bytes that differ between the
old line and the new one.

The second CSI sequence in the prompt above erases from the cursor
to the end of the line, but readline cannot know this.

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



reply via email to

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