From: Armaan Bhojwani Date: Sun, 31 Jan 2021 04:46:54 +0000 (-0500) Subject: Don't print more header separators than can fit X-Git-Tag: v0.2.0~9 X-Git-Url: https://git.armaanb.net/?p=lightcards.git;a=commitdiff_plain;h=c8546fd8d4542f139bd96a15ad2a704a54e9f3ca Don't print more header separators than can fit --- diff --git a/lightcards/display.py b/lightcards/display.py index 7a6ec1b..aa13c05 100755 --- a/lightcards/display.py +++ b/lightcards/display.py @@ -79,8 +79,12 @@ def disp_card(stdscr, stack, headers, obj): "; " + str(stack[obj.getIdx()][0]) + "\n" stdscr.addstr(top) - for i in range(len(top)): + (mlines, mcols) = stdscr.getmaxyx() + if len(top) < mcols: + mcols = len(top) + for i in range(mcols): stdscr.addch("=") + stdscr.addstr("\n" + str(stack[obj.getIdx()][obj.getSide()])) disp_bar(stdscr, stack, headers, obj)