I call readline with a prompt such as "\033[0m\033[0;1;34mmode>\033[0m
\033[1m", which on my VT100-compatible terminal displays "mode>" in blue and
makes the user's input bold. There are 21 characters that are not visible to
the user. When I press the up arrow to move backward through the history, it
will display the lines of history OK for a while and then suddenly it will
shift the first character of the history line 21 characters to the right.
The same thing can happen when I use CTRL+A to move to the start of the
line. I have confirmed that readline does not have the same problem if I
call it with a prompt of "mode> ".

 

I have been perusing the source code and note that display.c has a variable
prompt_invis_chars_first_line that appears to be intended to account for
this situation, however, I haven't figured out where that value gets set or
how to have it account for the invisible VT100 sequences.

 

Is there a way to coerce the code to ignore these VT100 sequences when
positioning the cursor at the end of the prompt?

 

Please note that I'm not subscribed to the list so please CC me on your
reply.

 

Tony Lewis

_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to