ui: fix escape sequences in in readline prompts (issue6930)...
ui: fix escape sequences in in readline prompts (issue6930)
Text that is meant to represent zero-width output in a readline
prompt, such as terminal escape sequences, is supposed to be
delimited by \001 ... \002:
> 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 `\001' and `\002', respectively). This may be used to
> embed terminal-specific escape sequences in prompts.
https://tiswww.cwru.edu/php/chet/readline/readline.html#index-rl_005fexpand_005fprompt
When formatting a readline prompt in ui._readline, arrange to do this
in the color.py labelling routines. Keeping mutable dynamically
scoped state like this isn't great but threading it as a parameter
through all the subroutines seems like much more trouble.
(This doesn't address the missing line break -- that's a separate bug
in libedit.)
https://bz.mercurial-scm.org/show_bug.cgi?id=6930