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    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to