From ce11c066c1b96a7abc7a56e3cb6b0a1174f93d4e Mon Sep 17 00:00:00 2001 From: Silas Kraume Date: Wed, 22 Feb 2023 13:13:04 +0100 Subject: [PATCH] fix calculation for longest line --- cat_win/util/Holder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cat_win/util/Holder.py b/cat_win/util/Holder.py index 42ce17f5..cf77c8c6 100644 --- a/cat_win/util/Holder.py +++ b/cat_win/util/Holder.py @@ -72,8 +72,8 @@ def __calcMaxLine__(self, file: str) -> int: heap = nlargest(1, lines, len) if len(heap) == 0: return 0 - longest_line_len = len(heap[0][:-1].rstrip()) - last_line_len = len(lines[-1].rstrip()) + longest_line_len = len(heap[0][:-1].rstrip(b'\n').rstrip(b'\r')) + last_line_len = len(lines[-1].rstrip(b'\n').rstrip(b'\r')) return len(str(max(longest_line_len, last_line_len)))