From 9a156baa87a9d7306868e40a7693c6d2aa700bb6 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 24 Jan 2021 22:23:18 +0900 Subject: [PATCH] Fix #7118: quickstart: got Mojibake if libreadline unavailable Do not output escape sequence for libreadline (\1 and \2) when libreadline is unavailable. --- CHANGES | 1 + sphinx/cmd/quickstart.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index b7acc1480..537c0b46d 100644 --- a/CHANGES +++ b/CHANGES @@ -83,6 +83,7 @@ Bugs fixed * #8665: html theme: Could not override globaltoc_maxdepth in theme.conf * #4304: linkcheck: Fix race condition that could lead to checking the availability of the same URL twice +* #7118: sphinx-quickstart: questionare got Mojibake if libreadline unavailable * #8094: texinfo: image files on the different directory with document are not copied * #8720: viewcode: module pages are generated for epub on incremental build 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