summaryrefslogtreecommitdiff
path: root/sphinx/cmd/quickstart.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2018-08-22 23:18:55 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2018-08-25 11:28:10 +0900
commit65654fd4324de92ef01f57c342321526de0bb496 (patch)
treefc42a28b6f4925fb717c00a5b411c8602b19db82 /sphinx/cmd/quickstart.py
parente34624cebdaf082ec68c7401eff306ca1eb77d30 (diff)
downloadsphinx-git-65654fd4324de92ef01f57c342321526de0bb496.tar.gz
Fix #5335: quickstart: escape sequence has been displayed with MacPorts' python
Diffstat (limited to 'sphinx/cmd/quickstart.py')
-rw-r--r--sphinx/cmd/quickstart.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py
index 01b6ca3be..32201d24c 100644
--- a/sphinx/cmd/quickstart.py
+++ b/sphinx/cmd/quickstart.py
@@ -25,10 +25,12 @@ try:
import readline
if readline.__doc__ and 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
+ USE_LIBEDIT = True
else:
readline.parse_and_bind("tab: complete")
+ USE_LIBEDIT = False
except ImportError:
- pass
+ USE_LIBEDIT = False
from docutils.utils import column_width
from six import PY2, PY3, text_type, binary_type
@@ -195,7 +197,13 @@ def do_prompt(text, default=None, validator=nonempty):
prompt = prompt.encode('utf-8')
except UnicodeEncodeError:
prompt = prompt.encode('latin1')
- prompt = colorize(COLOR_QUESTION, prompt, input_mode=True)
+ if USE_LIBEDIT:
+ # Note: libedit has a problem for combination of ``input()`` and escape
+ # sequence (see #5335). To avoid the problem, all prompts are not colored
+ # on libedit.
+ pass
+ else:
+ prompt = colorize(COLOR_QUESTION, prompt, input_mode=True)
x = term_input(prompt).strip()
if default and not x:
x = default