From c9b71a9817703e6a70b85fbc07d50c783901ba25 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sun, 6 Mar 2022 13:28:48 +0000 Subject: bitbake: knotty: Correctly handle multiple line items Currently the footer code doesn't quite handle multiline items correct. Fix this to do so. (Bitbake rev: 8eeccf73185d986c6abd6426b1d1e72da3a982df) Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/knotty.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 528b8a0760..1bcdc0023a 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -292,9 +292,9 @@ class TerminalFilter(object): progress = 0 content = self.main_progress.update(progress) print('') - lines = 1 + int(len(content) / (self.columns + 1)) + lines = self.getlines(content) if self.quiet == 0: - for tasknum, task in enumerate(tasks[:(self.rows - 2)]): + for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]): if isinstance(task, tuple): pbar, progress, rate, start_time = task if not pbar.start_time: @@ -311,11 +311,17 @@ class TerminalFilter(object): else: content = "%s: %s" % (tasknum, task) print(content) - lines = lines + 1 + int(len(content) / (self.columns + 1)) + lines = lines + self.getlines(content) self.footer_present = lines self.lastpids = runningpids[:] self.lastcount = self.helper.tasknumber_current + def getlines(self, content): + lines = 0 + for line in content.split("\n"): + lines = lines + 1 + int(len(line) / (self.columns + 1)) + return lines + def finish(self): if self.stdinbackup: fd = sys.stdin.fileno() -- cgit v1.2.3-54-g00ecf