]> jfr.im git - yt-dlp.git/commitdiff
[utils] render_table: Fix character calculation for removing extra gap
authorLesmiscore <redacted>
Sun, 6 Mar 2022 08:11:10 +0000 (17:11 +0900)
committerLesmiscore <redacted>
Sun, 6 Mar 2022 08:11:10 +0000 (17:11 +0900)
without this fix, the column next to delimiter will lack leading spaces on terminal (see https://github.com/yt-dlp/yt-dlp/pull/920#issuecomment-1059914615 for the situation)

yt_dlp/utils.py

index 87463c999b01fbc1e0dadf3f9f291507baee0ba7..8256d543e467ce58c1ab6da61f6d53037346d3bb 100644 (file)
@@ -3485,7 +3485,7 @@ def filter_using_list(row, filterArray):
     extra_gap += 1
     if delim:
         table = [header_row, [delim * (ml + extra_gap) for ml in max_lens]] + data
-        table[1][-1] = table[1][-1][:-extra_gap]  # Remove extra_gap from end of delimiter
+        table[1][-1] = table[1][-1][:-extra_gap * len(delim)]  # Remove extra_gap from end of delimiter
     for row in table:
         for pos, text in enumerate(map(str, row)):
             if '\t' in text: