From 9a156baa87a9d7306868e40a7693c6d2aa700bb6 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 24 Jan 2021 22:23:18 +0900 Subject: Fix #7118: quickstart: got Mojibake if libreadline unavailable Do not output escape sequence for libreadline (\1 and \2) when libreadline is unavailable. --- sphinx/cmd/quickstart.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sphinx/cmd') 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 -- cgit v1.2.3