bug-readline
[Top][All Lists]
Advanced

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

[Bug-readline] CSI sequences in prompt strings


From: LogicStuffs
Subject: [Bug-readline] CSI sequences in prompt strings
Date: Fri, 2 Dec 2016 21:23:21 +0100

Setup: Readline 6.3, gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Identical behaviour with xterm and gnome-terminal.

When I call readline with a prompt string containing CSI sequences and try to enter multiline input, and I get close before the end of the first line, the cursor is reset to the beginning of the line. Any more input then overwrites the prompt message, and then the previous input. After that, it is possible to fill the whole line with characters and get to the next line. Readline simply doesn't consider that not all of the prompt string's characters are printable.
Example source:

#define HANDLE_MULTIBYTE // not sure if this should help, doesn't work without it, either

#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>

int main()
{
char *input;

while((input = readline("\033[1;31mEnter input:\033[0m")) != NULL)
printf("You entered: %s\n", input);
}

After a quick skim through the sources, it seems that such prompt strings are not supported. Or are they? If not, is there a workaround?

reply via email to

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