comparison hgext/color.py @ 28633:e35d7f131483

ui: add prompt argument to write (issue5154) (API) When code like filemerge._iprompt calls ui.prompt, it expects the user to see the output in addition to getting the prompt. Other code such as histedit may call ui.pushbuffer, but its goal is not to interfere with prompts, so this commit adds an optional prompt flag to ui.write and has _readline include that argument. ui.promptchoice calls ui.prompt which calls ui._readline. This commit also updates hgext.color.write.
author timeless <timeless@mozdev.org>
date Fri, 25 Mar 2016 21:51:00 +0000
parents af3bd9d1dbc1
children a5d449a7bc8f
comparison
equal deleted inserted replaced
28631:c2e4e59aaea6 28633:e35d7f131483
422 def write(self, *args, **opts): 422 def write(self, *args, **opts):
423 if self._colormode is None: 423 if self._colormode is None:
424 return super(colorui, self).write(*args, **opts) 424 return super(colorui, self).write(*args, **opts)
425 425
426 label = opts.get('label', '') 426 label = opts.get('label', '')
427 if self._buffers: 427 if self._buffers and not opts.get('prompt', False):
428 if self._bufferapplylabels: 428 if self._bufferapplylabels:
429 self._buffers[-1].extend(self.label(a, label) for a in args) 429 self._buffers[-1].extend(self.label(a, label) for a in args)
430 else: 430 else:
431 self._buffers[-1].extend(args) 431 self._buffers[-1].extend(args)
432 elif self._colormode == 'win32': 432 elif self._colormode == 'win32':