From a2cf4e42258abb346f85f54e4dec4db694f65926 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Mon, 15 Jan 2018 23:11:28 +0100 Subject: [PATCH] color: make lrjust() work with multiple chars (#401) This fixes the issue if ljust with multiple characters like the banner separator char --- pwndbg/color/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pwndbg/color/__init__.py b/pwndbg/color/__init__.py index c76d0584e..c2dc12315 100644 --- a/pwndbg/color/__init__.py +++ b/pwndbg/color/__init__.py @@ -72,7 +72,9 @@ def terminateWith(x, color): return re.sub('\x1b\\[0m', NORMAL + color, x) def ljust_colored(x, length, char=' '): - return x + (length - len(strip(x))) * char + remaining = length - len(strip(x)) + return x + ((remaining // len(char) + 1) * char)[:remaining] def rjust_colored(x, length, char=' '): - return ((length - len(strip(x))) * char) + x + remaining = length - len(strip(x)) + return ((remaining // len(char) + 1) * char)[:remaining] + x