]> git.armaanb.net Git - lightcards.git/commitdiff
Move percent done from right to left
authorArmaan Bhojwani <me@armaanb.net>
Sat, 13 Feb 2021 04:03:58 +0000 (23:03 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Sat, 13 Feb 2021 14:17:57 +0000 (09:17 -0500)
lightcards/display.py

index 0b7fbd59af5db2fd02835f8b9f89de4f72ed4ed0..50b741808b14dc0ed18ed417c528322ac83cb2f1 100644 (file)
@@ -306,11 +306,6 @@ class Display:
         else:
             star_color = curses.color_pair(1)
 
-        progress = (
-            f"[{percent}% ("
-            f"{str(self.obj.index).zfill(len(str(len(self.stack))))})]"
-        )
-
         # Compose bar text
         bar_start = "["
         bar_middle = self.current_card().printStar()
@@ -333,9 +328,15 @@ class Display:
             curses.color_pair(1),
         )
 
+        progress = (
+            f"[{percent}% ("
+            f"{str(self.obj.index + 1).zfill(len(str(len(self.stack))))}"
+            f"/{str(len(self.stack))})] "
+        )
+
         self.win.addstr(
             height + 1,
-            mcols - len(progress) - 1,
+            0,
             progress,
             curses.color_pair(1),
         )
@@ -345,12 +346,14 @@ class Display:
                 self.obj.index
                 / (len(self.stack) - 1)
                 * (mcols - len(progress))
-                - 2
+                - 1
             )
         ):
             # TODO: Use the variying width unicode block characters to make a
             # super accurate bar
-            self.win.addch(height + 1, i, "»", curses.color_pair(1))
+            self.win.addch(
+                height + 1, i + len(progress), "»", curses.color_pair(1)
+            )
 
     def wrap_width(self):
         """Calculate the width at which the body text should wrap"""