retronews

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

commit 27183e11ef2363de858b53b4a5b52cfd5fbf73a2
parent ebfaf63dbc233364b8cf32692b84960962b9cddf
Author: luke8086 <55237178+luke8086@users.noreply.github.com>
Date:   Sat, 17 Jun 2023 14:39:59 +0000

Add command for marking messages as unread

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

diff --git a/retronews.py b/retronews.py @@ -52,6 +52,7 @@ KEY_BINDINGS: dict[int, Callable[["AppState"], None]] = { ord("x"): lambda app: cmd_close(app), ord("s"): lambda app: cmd_star(app), ord("S"): lambda app: cmd_star_thread(app), + ord("u"): lambda app: cmd_set_unread(app), ord("D"): lambda app: cmd_dump(app), ord("r"): lambda app: cmd_toggle_raw_mode(app), ord("k"): lambda app: cmd_up(app), @@ -79,7 +80,6 @@ HELP_SCREEN = """\ Available commands: q Quit retronews - ? Show this help message UP, DOWN Go up / down by one message / pager line PG UP, PG DOWN Gp up / down by one page of messages / pager lines p, n Go to previous / next message @@ -94,8 +94,9 @@ Available commands: < > Go to previous / next page g Go to specific page k j Scroll pager up / down by one line - s Star / unstar selected message + s Star / unstar current message S Star / unstar current thread + u Mark current message as unread r Toggle raw HTML mode See https://github.com/luke8086/retronews for more information. @@ -802,6 +803,13 @@ def cmd_star_thread(app: AppState) -> None: cmd_next(app) +def cmd_set_unread(app: AppState) -> None: + if (msg := app.selected_message) is not None: + msg.flags.read = False + db_save_message(app.db, msg) + cmd_next(app) + + def cmd_dump(app: AppState) -> None: if (msg := app.selected_message) is None: return