If percent > 0, even if it's very small, render some little sliver of
[python_utils.git] / text_utils.py
index 94df3e3499756a86955ebc3ee7330e5329720255..741e2a30dacd94306ac79a9c1cce4cc416b67e3f 100644 (file)
@@ -87,6 +87,8 @@ def bar_graph(
     if whole_width == width:
         whole_width -= 1
         part_char = "▉"
+    elif whole_width == 0 and percentage > 0.0:
+        part_char = "▏"
     else:
         remainder_width = (percentage * width) % 1
         part_width = math.floor(remainder_width * 8)
@@ -136,9 +138,7 @@ def distribute_strings(
     return retval
 
 
-def justify_string_by_chunk(
-    string: str, width: int = 80, padding: str = " "
-) -> str:
+def justify_string_by_chunk(string: str, width: int = 80, padding: str = " ") -> str:
     """
     Justifies a string.