Commit f94138a1 authored by Torsten Schönfeld's avatar Torsten Schönfeld Committed by Craig Keogh

Fix status line in quiet mode

Avoid corruption of the status line by taking into account control
characters when calculating string lengths.
parent 507a1a68
......@@ -128,12 +128,13 @@ class TerminalBuildScript(buildscript.BuildScript):
module_pos = '[' + format_str % module_num + '/' + format_str % len(self.modulelist) + ']'
output = '%s %s %s%s%s' % (progress_bar, module_pos, t_bold, message, t_reset)
if len(output) > columns:
output = output[:columns]
text_width = len(output) - (len(t_bold) + len(t_reset))
if text_width > columns:
output = output[:columns+len(t_bold)] + t_reset
else:
output += ' ' * (columns-len(output))
output += ' ' * (columns-text_width)
sys.stdout.write(output + '\r')
sys.stdout.write('\r'+output)
if self.is_end_of_build:
sys.stdout.write('\n')
sys.stdout.flush()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment