##// END OF EJS Templates
ui: fix escape sequences in in readline prompts (issue6930)...
Taylor R Campbell -
r53339:b3214b7d stable
parent child Browse files
Show More
@@ -386,6 +386,9 def _render_effects(ui, text, effects):
386 ]
386 ]
387 start = b'\033[' + b';'.join(start) + b'm'
387 start = b'\033[' + b';'.join(start) + b'm'
388 stop = b'\033[' + pycompat.bytestr(activeeffects[b'none']) + b'm'
388 stop = b'\033[' + pycompat.bytestr(activeeffects[b'none']) + b'm'
389 if ui._readlineprompt:
390 start = b'\001' + start + b'\001'
391 stop = b'\002' + stop + b'\002'
389 return _mergeeffects(text, start, stop)
392 return _mergeeffects(text, start, stop)
390
393
391
394
@@ -518,7 +521,8 if pycompat.iswindows:
518 else:
521 else:
519 origattr = csbi.wAttributes
522 origattr = csbi.wAttributes
520 ansire = re.compile(
523 ansire = re.compile(
521 br'\033\[([^m]*)m([^\033]*)(.*)', re.MULTILINE | re.DOTALL
524 br'\001?\033\[([^m]*)m\002?([^\033]*)(.*)',
525 re.MULTILINE | re.DOTALL,
522 )
526 )
523
527
524 def win32print(ui, writefunc, text, **opts):
528 def win32print(ui, writefunc, text, **opts):
@@ -265,6 +265,8 class ui:
265 self.logblockedtimes = False
265 self.logblockedtimes = False
266 # color mode: see mercurial/color.py for possible value
266 # color mode: see mercurial/color.py for possible value
267 self._colormode = None
267 self._colormode = None
268 # readline prompt: is this currently for a readline prompt?
269 self._readlineprompt = False
268 self._terminfoparams = {}
270 self._terminfoparams = {}
269 self._styles = {}
271 self._styles = {}
270 self._uninterruptible = False
272 self._uninterruptible = False
@@ -1745,7 +1747,12 class ui:
1745 self.flush()
1747 self.flush()
1746 prompt = b' '
1748 prompt = b' '
1747 else:
1749 else:
1748 prompt = self.label(prompt, b'ui.prompt') + b' '
1750 wasreadlineprompt = self._readlineprompt
1751 try:
1752 self._readlineprompt = True
1753 prompt = self.label(prompt, b'ui.prompt') + b' '
1754 finally:
1755 self._readlineprompt = wasreadlineprompt
1749
1756
1750 # prompt ' ' must exist; otherwise readline may delete entire line
1757 # prompt ' ' must exist; otherwise readline may delete entire line
1751 # - http://bugs.python.org/issue12833
1758 # - http://bugs.python.org/issue12833
General Comments 0
You need to be logged in to leave comments. Login now