# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1517831331 -32400
#      Mon Feb 05 20:48:51 2018 +0900
# Node ID 59869758acd7b38d9de045d5a72f5196cc80f047
# Parent  9be8a0f8d48502734066a66e3d5b9b22e460ae70
ui: add explicit path to write prompt text bypassing buffers

The prompt= flag was added at e35d7f131483, when colorui had its own write()
function. Since we've merged colorui to ui, we can simply call the unbuffered
write() function.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -886,13 +886,17 @@ class ui(object):
         "cmdname.type" is recommended. For example, status issues
         a label of "status.modified" for modified files.
         '''
-        if self._buffers and not opts.get(r'prompt', False):
+        if self._buffers:
             if self._bufferapplylabels:
                 label = opts.get(r'label', '')
                 self._buffers[-1].extend(self.label(a, label) for a in args)
             else:
                 self._buffers[-1].extend(args)
-        elif self._colormode == 'win32':
+        else:
+            self._writenobuf(*args, **opts)
+
+    def _writenobuf(self, *args, **opts):
+        if self._colormode == 'win32':
             # windows color printing is its own can of crab, defer to
             # the color module and that is it.
             color.win32print(self, self._write, *args, **opts)
@@ -1276,7 +1280,7 @@ class ui(object):
         if not self.interactive():
             self.write(msg, ' ', default or '', "\n")
             return default
-        self.write(msg, label='ui.prompt', prompt=True)
+        self._writenobuf(msg, label='ui.prompt')
         self.flush()
         try:
             r = self._readline()
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to