# HG changeset patch # User Yuya Nishihara # Date 2018-02-05 11:48:51 # Node ID b62c4154bb287fe0f4c15cdb0d2ef290069288df # Parent fd54846e1f8edaef01bf4ed4f2675d8ba06c5bca 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()