Mercurial > hg-stable
changeset 15053:17ffb30d9174 stable
ui: pass ' ' to raw_input when prompting
This is a workaround for calling ui.prompt(...), typing some character then
hitting backspace which causes the entire line to delete rather than just the
one character. This was seen on Debian using gnome-terminal.
(credits to Mads for the idea)
Python bug can be found here: http://bugs.python.org/issue12833
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Thu, 25 Aug 2011 22:06:03 +0300 |
parents | 06c3667c259c |
children | 7c03e3b1b858 d629f1e89021 |
files | mercurial/ui.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/ui.py Thu Aug 25 17:20:00 2011 +0200 +++ b/mercurial/ui.py Thu Aug 25 22:06:03 2011 +0300 @@ -544,7 +544,7 @@ # instead of trying to emulate raw_input, swap self.fin with sys.stdin old = sys.stdin sys.stdin = self.fin - line = raw_input() + line = raw_input(' ') sys.stdin = old # When stdin is in binary mode on Windows, it can cause @@ -561,7 +561,7 @@ self.write(msg, ' ', default, "\n") return default try: - r = self._readline(self.label(msg, 'ui.prompt') + ' ') + r = self._readline(self.label(msg, 'ui.prompt')) if not r: return default return r