##// END OF EJS Templates
add a simple nested buffering scheme to ui
Matt Mackall -
r3737:9f5c46c5 default
parent child Browse files
Show More
@@ -29,6 +29,7 b' class ui(object):'
29 interactive=True, traceback=False, report_untrusted=True,
29 interactive=True, traceback=False, report_untrusted=True,
30 parentui=None):
30 parentui=None):
31 self.overlay = None
31 self.overlay = None
32 self.buffers = []
32 if parentui is None:
33 if parentui is None:
33 # this is the parent of all ui children
34 # this is the parent of all ui children
34 self.parentui = None
35 self.parentui = None
@@ -367,7 +368,16 b' class ui(object):'
367 path = self.config("paths", default)
368 path = self.config("paths", default)
368 return path or loc
369 return path or loc
369
370
371 def pushbuffer(self):
372 self.buffers.append([])
373
374 def popbuffer(self):
375 return "".join(self.buffers.pop())
376
370 def write(self, *args):
377 def write(self, *args):
378 if self.buffers:
379 self.buffers[-1].extend([str(a) for a in args])
380 else:
371 for a in args:
381 for a in args:
372 sys.stdout.write(str(a))
382 sys.stdout.write(str(a))
373
383
General Comments 0
You need to be logged in to leave comments. Login now