diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-01-24 16:23:18 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-01-25 14:36:53 +0300 |
commit | 9a156baa87a9d7306868e40a7693c6d2aa700bb6 (patch) | |
tree | c9baa88f4b404cd920582dfee57c9ff8f2ce853f /sphinx/cmd | |
parent | 8203642c41707948af20f03c1d0eb926a90bfc4e (diff) |
Fix #7118: quickstart: got Mojibake if libreadline unavailable
Do not output escape sequence for libreadline (\1 and \2) when
libreadline is unavailable.
Diffstat (limited to 'sphinx/cmd')
-rw-r--r-- | sphinx/cmd/quickstart.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py index 7d1c48f31..4234c039c 100644 --- a/sphinx/cmd/quickstart.py +++ b/sphinx/cmd/quickstart.py @@ -29,6 +29,7 @@ try: readline.parse_and_bind("tab: complete") USE_LIBEDIT = False except ImportError: + readline = None USE_LIBEDIT = False from docutils.utils import column_width @@ -169,8 +170,11 @@ def do_prompt(text: str, default: str = None, validator: Callable[[str], Any] = # sequence (see #5335). To avoid the problem, all prompts are not colored # on libedit. pass - else: + elif readline: + # pass input_mode=True if readline available prompt = colorize(COLOR_QUESTION, prompt, input_mode=True) + else: + prompt = colorize(COLOR_QUESTION, prompt, input_mode=False) x = term_input(prompt).strip() if default and not x: x = default |