From 9999d975b4b3b6d0bb2f6c8e3100157309c3916f Mon Sep 17 00:00:00 2001 From: Daniel Schwarz Date: Thu, 9 Mar 2023 17:30:04 -0500 Subject: [PATCH] Fixed refresh so it stays on the currently selected timeline Fixes issue #337 --- toot/tui/app.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/toot/tui/app.py b/toot/tui/app.py index ded4809..e04f7a6 100644 --- a/toot/tui/app.py +++ b/toot/tui/app.py @@ -493,7 +493,7 @@ class TUI(urwid.Frame): def goto_public_timeline(self, local): self.timeline_generator = api.public_timeline_generator( self.app, self.user, local=local, limit=40) - promise = self.async_load_timeline(is_initial=True, timeline_name="public") + promise = self.async_load_timeline(is_initial=True, timeline_name="local public" if local else "global public") promise.add_done_callback(lambda *args: self.close_overlay()) def goto_bookmarks(self): @@ -733,8 +733,26 @@ class TUI(urwid.Frame): elif key == ',': if not self.overlay: - self.timeline_generator = api.home_timeline_generator( - self.app, self.user, limit=40) + if self.timeline.name == 'bookmarks': + return # no point in refreshing the bookmarks timeline + if self.timeline.name.startswith("#"): + self.timeline_generator = api.tag_timeline_generator( + self.app, self.user, self.timeline.name[1:], limit=40) + else: + if self.timeline.name.endswith('public'): + self.timeline_generator = api.public_timeline_generator( + self.app, self.user, local=self.timeline.name.startswith('local'), limit=40) + elif self.timeline.name == 'notifications': + self.timeline_generator = api.notification_timeline_generator( + self.app, self.user, limit=40) + elif self.timeline.name == 'conversations': + self.timeline_generator = api.conversation_timeline_generator( + self.app, self.user, limit=40) + else: + # default to home timeline + self.timeline_generator = api.home_timeline_generator( + self.app, self.user, limit=40) + self.async_load_timeline(is_initial=True, timeline_name=self.timeline.name) elif key == 'esc':