From c8546fd8d4542f139bd96a15ad2a704a54e9f3ca Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Sat, 30 Jan 2021 23:46:54 -0500 Subject: [PATCH] Don't print more header separators than can fit --- lightcards/display.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.39.2