retronews

a featureful fork of the luke8086/retronews hn+lobste.rs tui
Log | Files | Refs | README | LICENSE

commit fc6109f8dc2380cf5bb39e93e4bc8c9a14c23c96
parent 3a2e732443eb6f6edc1f8efcefbc9e52338fb830
Author: luke8086 <55237178+luke8086@users.noreply.github.com>
Date:   Fri, 22 Jul 2022 17:53:39 +0000

Minor refactoring for rendering index rows

Diffstat:
Mretronews.py | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/retronews.py b/retronews.py @@ -286,15 +286,17 @@ def app_get_index_height(app: AppState) -> int: def app_render_index_row(app: AppState, row: int, message: Message) -> None: cols = app.screen.getmaxyx()[1] + date = message.date.strftime("%Y-%m-%d %H:%M") + author = message.author[:10].ljust(10) - app.screen.addstr(row, 0, "[ ] [ ]") - app.screen.addstr(row, 1, message.date.strftime("%Y-%m-%d %H:%M"), app.colors.date) - app.screen.addstr(row, 21, message.author[:10], app.colors.author) - app.screen.addstr(row, 34, message.index_tree, app.colors.tree) - app.screen.addstr(row, 34 + len(message.index_tree), message.title) + app.screen.insstr(row, 0, f"[{date}] [{author}] {message.index_tree}{message.title}") if message == app.selected_message: app.screen.chgat(row, 0, cols, app.colors.cursor) + else: + app.screen.chgat(row, 1, 16, app.colors.date) + app.screen.chgat(row, 21, 10, app.colors.author) + app.screen.chgat(row, 34, len(message.index_tree), app.colors.tree) def app_render_index(app: AppState, height: int) -> None: