'What happened to the RL_PROMPT_START_IGNORE in readline for python?
Trying to resolve some coloring issues when using readline (cpython), I can no longer find the equivalent functions using the RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE constant to determine how to calculate lengths of strings containing non-printable characters. According to original (?) GNU readline documentation, there should be some functions, one of which is rl_expand_prompt().
Expand any special character sequences in prompt and set up the local Readline prompt redisplay variables. This function is called by readline(). It may also be called to expand the primary prompt if the rl_on_new_line_with_prompt() function or rl_already_prompted variable is used. It returns the number of visible characters on the last line of the (possibly multi-line) prompt. 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 RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE (declared in `readline.h'). This may be used to embed terminal-specific escape sequences in prompts.
These can indeed be found in the current readline sources here:
- http://git.savannah.gnu.org/cgit/readline.git/tree/readline.c
- http://git.savannah.gnu.org/cgit/readline.git/tree/readline.h
/* Definitions available for use by readline clients. */
#define RL_PROMPT_START_IGNORE '\001'
#define RL_PROMPT_END_IGNORE '\002'
However, none of these items can be found in the cpython implementation of readline.c or readline.c.h.
(Yes, they actually name the header file like that! :D )
Also, there is no sane bug tracking enabled for their code repository, which certainly doesn't help any development progress. Instead they seem to rely on some obscure 1990's email lists.
Where can I find the code handling ANSI escape sequences in the python version of readline?
(And what happened to the special markers?)
Some related questions:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
