bug-readline
[Top][All Lists]
Advanced

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

Re: Bug: Color prompts break newline triggering


From: Chet Ramey
Subject: Re: Bug: Color prompts break newline triggering
Date: Sat, 28 Oct 2023 15:08:26 -0400
User-agent: Mozilla Thunderbird

On 10/28/23 11:03 AM, Samuel Cordero Rodrigo wrote:
Readline8.2-release installed from brew running on a 2017 Macbook Pro with Mac OS Mojave.  When adding color escape sequences like \x1b[32m, readline seems to break first newline toggling for long lines (screenshot attached). To reproduce just add a color prompt like prompt="\x1b[32mTEST\x1b[0m", call readline(prompt) and write a bunch of chars. An easy fix might be replacing strlen with an ad-hoc solution that doesn't count those chars.

"Applications may indicate that the prompt contains characters that take
up no physical screen space when displayed by bracketing a sequence of
such characters with the special markers @code{RL_PROMPT_START_IGNORE}
and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h} as
@samp{\001} and @samp{\002}, respectively).
This may be used to embed terminal-specific escape sequences in prompts."

This is how bash implements the \[ and \] prompt string expansions.

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