You are not logged in.
Pages: 1
Hello,
when using the editline package I found that you can't use escape sequence to output text in bold or color...
I came to stackoverflow and found this
In one of the answer which is for a mac it says that there is a line in the code source to modify because there is a typo in there.
So I look on the source of the package and there it is in readline.c: the same error:
line 323 should be:
el_set(e, EL_PROMPT_ESC, _get_prompt, RL_PROMPT_START_IGNORE);
but is:
el_set(e, EL_PROMPT, _get_prompt, RL_PROMPT_START_IGNORE);
use this code: bugMin.c
#include <stdlib.h>
#include <editline/readline.h>
#define BOLD_RED "\1\e[1;31m"
#define RESET "\e[0m"
int main () {
char* input = readline (
BOLD_RED
"this text should be red and bold> "
RESET
);
free (input);
return 0;
}
to see the bug in action:
$> gcc bugMin.c -ledit
and
$> ./a.out
download the source from http://thrysoee.dk/editline/ (this is the upstream link given at this page)
then expand the archive, open readline.c in the src folder and make the change on line 323.(EL_PROMPT >>>> EL_PROMPT_ESC)
mkdir $HOME/fixedEditLine
(this step might not be needed)
go in the root of the expanded archive
$> ./configure --prefix $HOME/fixedEditLine/
$> make
$> make install
then go where you first compile bugMin.c and do
$> export LD_LIBRARY_PATH=$HOME/fixedEditLine/lib
for ld to find the correct shared librarie
and then no need to recompile the test file just do
$> ./a.out
You can even play with it by opening an other terminal window (the export should not be active in this window) and when you run the program you see the bug again.
be careful with this one
$> cd
$> rm -rf fixedEditLine
and then remove the archive and the folders that you expand from it
I don't know where I should post that so I put it in here
This "fix" isn't complete because when you use escape sequence it break the behavior of special keys such as arrows.
Offline
notes:
I don't know where I should post that so I put it in here
This "fix" isn't complete because when you use escape sequence it break the behavior of special keys such as arrows.
Thanks for sharing the fix. It would be even better if you submitted it to the upstream developer. Check if there is already a bug report. If there is, post your fix there. If not, create a new ticket (or just email the dev if there is no bug tracker).
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Pages: 1