[Top][All Lists]

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

Re: [Bug Report] The Unexpected Behavior When Using ANSI Escape Code

From: Chet Ramey
Subject: Re: [Bug Report] The Unexpected Behavior When Using ANSI Escape Code
Date: Mon, 21 Mar 2022 09:47:34 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

On 3/21/22 5:00 AM, Michaelll Lee wrote:

While using non-printing characters without "\[...\]" proves to be fine in
versions prior to 5.x.x (e.g., many suggestions from some online forums
have suggested "PS1=\e[0m" for using ANSI escape code in the prompt), the
same configuration in 5.x.x is not as stable as the previous versions(i.e.,
"PS1=\[\e[0m\]" should be used instead of "PS1=\e[0m", otherwise the
unexpected behavior(STEP7) will happen).

This has never been true.

Readline's display relies on knowing the physical cursor position. Unless
told otherwise, it assumes that every character it outputs contributes to
that physical cursor position. Eventually, the incorrect value that results
from non-printing characters will mess up redisplay.

``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]