ui: add brief comment why raw_input() needs dummy ' ' prompt string
authorYuya Nishihara <yuya@tcha.org>
Sun, 24 Aug 2014 12:35:53 +0900
changeset 22291 3b39e1522d8f
parent 22290 dcb95aadf850
child 22292 102f0e926668
ui: add brief comment why raw_input() needs dummy ' ' prompt string Retrieved from 17ffb30d9174. I was about to move ' ' to label(msg + ' ', 'ui.prompt') so that subclass can distinguish prompt output from data. But it was not that simple.
mercurial/ui.py
--- a/mercurial/ui.py	Sun Aug 24 23:47:26 2014 +0900
+++ b/mercurial/ui.py	Sun Aug 24 12:35:53 2014 +0900
@@ -626,6 +626,8 @@
         oldout = sys.stdout
         sys.stdin = self.fin
         sys.stdout = self.fout
+        # prompt ' ' must exist; otherwise readline may delete entire line
+        # - http://bugs.python.org/issue12833
         line = raw_input(' ')
         sys.stdin = oldin
         sys.stdout = oldout