From 5bde928311b41e8ff745b01f6c62d0a935575ec8 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 25 May 2023 17:25:45 +0300 Subject: [PATCH] Fixed package and version alignment --- slpkg/views/asciibox.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/slpkg/views/asciibox.py b/slpkg/views/asciibox.py index 8801134b..9d603718 100644 --- a/slpkg/views/asciibox.py +++ b/slpkg/views/asciibox.py @@ -90,10 +90,11 @@ class AsciiBox(Configs): f"{self.bd_color}{self.vertical_line}{self.endc}") def draw_package_line(self, package: str, version: str, size: str, color: str, repo: str) -> None: - if len(version) >= 20 and self.columns <= 80: + if len(version) >= (self.version_alignment - 5): version: str = f'{version[:self.version_alignment - 5]}...' - if len(package) >= 15 and self.columns <= 80: - package: str = f'{package[:self.package_alignment - 5]}...' + if len(package) >= (self.package_alignment - 4): + package: str = f'{package[:self.package_alignment - 4]}...' + print(f"{self.bd_color}{self.vertical_line} {self.bold}{color}{package:<{self.package_alignment}}{self.endc}" f"{self.bd_color}{version:<{self.version_alignment}}{self.endc}{size:<{self.size_alignment}}{self.blue}" f"{repo:>{self.repo_alignment}}{self.bd_color} {self.vertical_line}{self.endc}")