]> git.armaanb.net Git - lightcards.git/blobdiff - lightcards/display.py
Fix length of separator line
[lightcards.git] / lightcards / display.py
index 54277d36756064184933ae2ded8a924a11744947..e9e5b267a37299262d63327ad429ad839bc72ae3 100755 (executable)
@@ -27,7 +27,9 @@ def disp_bar(stdscr, stack, headers, obj):
                   ")]" +
                   " [" +
                   headers[obj.getSide()] +
-                  "]", curses.color_pair(1))
+                  " (" +
+                  str(obj.getSide() + 1) +
+                  ")]", curses.color_pair(1))
 
 
 def disp_menu(stdscr, stack, headers, idx):
@@ -81,11 +83,10 @@ def disp_card(stdscr, stack, headers, obj):
         disp_menu(stdscr, stack, headers, obj)
     else:
         if obj.getSide() == 0:
-            top = headers[obj.getSide()] + "; " + str(obj.getIdx() + 1)
+            top = str(obj.getIdx() + 1) + " | " + headers[obj.getSide()]
         else:
-            top = headers[obj.getSide()] + "; " + str(obj.getIdx() + 1) + \
-                "; " + str(stack[obj.getIdx()][0])
-
+            top = str(obj.getIdx() + 1) + " | " + headers[obj.getSide()] \
+                + " | \"" + str(stack[obj.getIdx()][0]) + "\""
         header_width = mcols
         if mcols > 80:
             header_width = 80
@@ -94,8 +95,8 @@ def disp_card(stdscr, stack, headers, obj):
                                        placeholder="…"), curses.A_BOLD)
 
         # Add horizontal line
-        lin_width = mcols
-        if len(top) < mcols:
+        lin_width = header_width
+        if len(top) < header_width:
             lin_width = len(top)
         stdscr.hline(1, 0, curses.ACS_HLINE, lin_width)
 
@@ -103,7 +104,6 @@ def disp_card(stdscr, stack, headers, obj):
         wrap_width = mcols
         if mcols > 80:
             wrap_width = 80
-        stdscr.hline(curses.ACS_HLINE, lin_width)
         stdscr.addstr(2, 0, textwrap.fill(stack[obj.getIdx()][obj.getSide()],
                                           width=wrap_width))
     disp_bar(stdscr, stack, headers, obj)
@@ -133,7 +133,9 @@ def get_key(stdscr, stack, headers, idx):
             disp_card(stdscr, stack, headers, idx)
         elif key in ["0", "^", "KEY_HOME"]:
             idx.setIdx(0)
+            idx.setSide(0)
             disp_card(stdscr, stack, headers, idx)
         elif key in ["$", "KEY_END"]:
             idx.setIdx(len(stack) - 1)
+            idx.setSide(0)
             disp_card(stdscr, stack, headers, idx)