Skip to content

Prompt with escape sequences breaks backspace handling #168

Open
@egranata

Description

@egranata

Imagine doing something like this

        prompt.append_sprintf("\x1b[38;2;205;205;0m%s\x1b[0m$ ", cwd.c_str());

in order to (in this case) color the CWD yellow in a shell prompt.

If linenoise is fed this prompt text, it will do an incorrect calculation of how many characters to move the cursor by in a refreshSingleLine() call after, e.g., pressing BACKSPACE - assuming that it needs to backspace the non-printable escape sequence characters

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions