]> git.armaanb.net Git - lightcards.git/commitdiff
Don't print more header separators than can fit
authorArmaan Bhojwani <me@armaanb.net>
Sun, 31 Jan 2021 04:46:54 +0000 (23:46 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 31 Jan 2021 04:47:12 +0000 (23:47 -0500)
lightcards/display.py

index 7a6ec1b22ffbb0bd667e05fde4ef638b88daa018..aa13c05e38809089f7e236f6d901f1f54a66895f 100755 (executable)
@@ -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)