Fix padding
This commit is contained in:
parent
2989101e67
commit
3ce4a7148a
1 changed files with 13 additions and 13 deletions
|
@ -292,9 +292,10 @@ def print_status(status: Status, width: int = 80, padding: int = 0):
|
||||||
if display_name:
|
if display_name:
|
||||||
spacing -= wcswidth(display_name) + 1
|
spacing -= wcswidth(display_name) + 1
|
||||||
|
|
||||||
|
paddings = "│" * padding
|
||||||
|
|
||||||
print_out(
|
print_out(
|
||||||
"│" * padding,
|
paddings + (f"<green>{display_name}</green>" if display_name else ""),
|
||||||
f"<green>{display_name}</green>" if display_name else "",
|
|
||||||
f"<blue>{username}</blue>",
|
f"<blue>{username}</blue>",
|
||||||
" " * spacing,
|
" " * spacing,
|
||||||
f"<yellow>{time}</yellow>",
|
f"<yellow>{time}</yellow>",
|
||||||
|
@ -302,35 +303,34 @@ def print_status(status: Status, width: int = 80, padding: int = 0):
|
||||||
|
|
||||||
print_out("│" * padding)
|
print_out("│" * padding)
|
||||||
if status.spoiler_text:
|
if status.spoiler_text:
|
||||||
print_out("│" * padding, "<yellow>Subject</yellow>: ", end="")
|
print_out(paddings + "<yellow>Subject</yellow>: ", end="")
|
||||||
print_html(status.spoiler_text)
|
print_html(status.spoiler_text)
|
||||||
print_out("│" * padding)
|
print_out(paddings)
|
||||||
print_html(status.content, width, padding)
|
print_html(status.content, width, padding)
|
||||||
|
|
||||||
if status.media_attachments:
|
if status.media_attachments:
|
||||||
print_out(f"{'│' * padding}\n{'│' * padding}Media:")
|
print_out(f"{paddings}\n{paddings}Media:")
|
||||||
for count, attachment in enumerate(status.media_attachments):
|
for count, attachment in enumerate(status.media_attachments):
|
||||||
url = attachment.url
|
url = attachment.url
|
||||||
description = f'Description: {attachment.description}'
|
description = f'Description: {attachment.description}'
|
||||||
print_out(f'{"│" * padding}{count+1}. <yellow>URL</yellow>: {url}')
|
print_out(f'{paddings}{count+1}. <yellow>URL</yellow>: {url}')
|
||||||
for i, line in enumerate(wc_wrap(description, width - padding)):
|
for i, line in enumerate(wc_wrap(description, width - padding)):
|
||||||
if i == 0:
|
if i == 0:
|
||||||
line = line.replace('Description', '<yellow>Description</yellow>')
|
line = line.replace('Description', '<yellow>Description</yellow>')
|
||||||
print_out('│' * padding + line)
|
print_out(paddings + line)
|
||||||
|
|
||||||
if status.poll:
|
if status.poll:
|
||||||
print_poll(status.poll)
|
print_poll(status.poll)
|
||||||
|
|
||||||
print_out("│" * padding)
|
print_out(paddings)
|
||||||
|
|
||||||
reacts = ("\n│" * padding + " ").join([f'{react.count} × {react.name}'
|
reacts = ('\n' + paddings).join([f'{react.count} × {react.name}'
|
||||||
for react in status.emoji_reactions])
|
for react in status.emoji_reactions])
|
||||||
if reacts:
|
if reacts:
|
||||||
reacts = "│" * padding + " " + reacts
|
reacts = paddings + reacts
|
||||||
|
|
||||||
print_out(
|
print_out(
|
||||||
"│" * padding,
|
paddings + (f"<yellow>Reacts:</yellow>\n{reacts}\n{paddings}" if reacts else ""),
|
||||||
f"<yellow>Reacts:</yellow>\n{reacts}\n{'│' * padding}" if reacts else "",
|
|
||||||
f"ID <yellow>{status_id}</yellow> ",
|
f"ID <yellow>{status_id}</yellow> ",
|
||||||
f"↲ In reply to <yellow>{in_reply_to_id}</yellow> " if in_reply_to_id else "",
|
f"↲ In reply to <yellow>{in_reply_to_id}</yellow> " if in_reply_to_id else "",
|
||||||
f"↻ <blue>@{reblogged_by.acct}</blue> boosted " if reblogged_by else "",
|
f"↻ <blue>@{reblogged_by.acct}</blue> boosted " if reblogged_by else "",
|
||||||
|
@ -344,7 +344,7 @@ def print_html(text, width=80, padding=0):
|
||||||
print_out("│" * padding)
|
print_out("│" * padding)
|
||||||
for line in paragraph:
|
for line in paragraph:
|
||||||
for subline in wc_wrap(line, width):
|
for subline in wc_wrap(line, width):
|
||||||
print_out("│" * padding, highlight_hashtags(subline))
|
print_out("│" * padding + highlight_hashtags(subline))
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue