Improve rendering of list view - toot - Unnamed repository; edit this file 'des… | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit c6b1d913707e9a107b44537e1f67dac73d82fe72 | |
parent 760a80442cbaa76ed8061d264fb9167cd2bb525e | |
Author: Ivan Habunek <[email protected]> | |
Date: Mon, 22 Jan 2018 10:18:44 +0100 | |
Improve rendering of list view | |
Fixes appearence when unicode wraps due to wide characters. | |
Not a real fix, but looks nicer. | |
Diffstat: | |
toot/ui/app.py | 14 ++++++++++---- | |
1 file changed, 10 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/toot/ui/app.py b/toot/ui/app.py | |
@@ -119,10 +119,6 @@ class StatusListWindow: | |
height, width = self.pad.getmaxyx() | |
color = Color.GREEN if highlight else Color.WHITE | |
- date, time = status['created_at'] | |
- self.pad.addstr(offset + 1, 1, " " + date.ljust(14), color) | |
- self.pad.addstr(offset + 2, 1, " " + time.ljust(14), color) | |
- | |
trunc_width = width - 15 | |
acct = trunc("@" + status['account']['acct'], trunc_width).ljust(trunc… | |
display_name = trunc(status['account']['display_name'], trunc_width).l… | |
@@ -133,6 +129,16 @@ class StatusListWindow: | |
else: | |
self.pad.addstr(offset + 1, 14, acct, color) | |
+ date, time = status['created_at'] | |
+ self.pad.addstr(offset + 1, 1, " " + date.ljust(12), color) | |
+ self.pad.addstr(offset + 2, 1, " " + time.ljust(12), color) | |
+ | |
+ # Redraw box borders to mitigate unicode overflow issues | |
+ self.pad.addch(offset + 1, 0, "│") | |
+ self.pad.addch(offset + 2, 0, "│") | |
+ self.pad.addch(offset + 1, width - 1, "│") | |
+ self.pad.addch(offset + 2, width - 1, "│") | |
+ | |
if draw_divider: | |
draw_horizontal_divider(self.pad, offset + 3) | |