From 2b47b684dc6f4814c0b66bbb93617048df06b433 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 31 Aug 2024 10:35:11 +0200 Subject: [PATCH 1/2] JobStatusDisplay: fix setting the default width to 100 This fixes a28a0fd66002 ("JobStatusDisplay: increase the default width to 100") which attempted to set the default width to 100. However, the out of bounds check in _set_width() was not adjusted. Therefore, the default width was effectively still 80. Fixes: a28a0fd6600242a2e062a0fd2d7d5be95296b7ae Signed-off-by: Florian Schmaus --- lib/_emerge/JobStatusDisplay.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/JobStatusDisplay.py b/lib/_emerge/JobStatusDisplay.py index 78fd8f7618..6506aed7dc 100644 --- a/lib/_emerge/JobStatusDisplay.py +++ b/lib/_emerge/JobStatusDisplay.py @@ -71,8 +71,8 @@ def __init__(self, quiet=False, xterm_titles=True): def _set_width(self, width): if width == getattr(self, "width", None): return - if width <= 0 or width > 80: - width = 80 + if width <= 0 or width > 100: + width = 100 object.__setattr__(self, "width", width) object.__setattr__(self, "_jobs_column_width", width - 32) From 636c59a52195db85c307239899c88c83afd1122a Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 31 Aug 2024 10:38:51 +0200 Subject: [PATCH 2/2] JobStatusDisplay: introduce max_display_width variable Values that belong together and may only be changed at the same time should be combined in a common constant. So let's do this. Signed-off-by: Florian Schmaus --- lib/_emerge/JobStatusDisplay.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/_emerge/JobStatusDisplay.py b/lib/_emerge/JobStatusDisplay.py index 6506aed7dc..57495c5ae5 100644 --- a/lib/_emerge/JobStatusDisplay.py +++ b/lib/_emerge/JobStatusDisplay.py @@ -16,6 +16,9 @@ class JobStatusDisplay: + # Used as maximum display width and default fallback value. + max_display_width = 100 + _bound_properties = ("curval", "failed", "running") # Don't update the display unless at least this much @@ -65,14 +68,14 @@ def __init__(self, quiet=False, xterm_titles=True): if self._isatty: width = portage.output.get_term_size()[1] else: - width = 100 + width = self.max_display_width self._set_width(width) def _set_width(self, width): if width == getattr(self, "width", None): return - if width <= 0 or width > 100: - width = 100 + if width <= 0 or width > self.max_display_width: + width = self.max_display_width object.__setattr__(self, "width", width) object.__setattr__(self, "_jobs_column_width", width - 32)