1
0
mirror of https://github.com/ihabunek/toot.git synced 2024-12-04 14:46:33 -05:00

Focus status after posting

This commit is contained in:
Ivan Habunek 2019-08-28 17:04:45 +02:00
parent 4deccee754
commit 5213eb1835
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95
2 changed files with 8 additions and 0 deletions

View File

@ -280,7 +280,11 @@ class TUI(urwid.Frame):
data = api.post_status(self.app, self.user, content,
spoiler_text=warning, visibility=visibility)
status = Status(data, self.app.instance)
# TODO: instead of this, fetch new items from the timeline?
self.timeline.prepend_status(status)
self.timeline.focus_status(status)
self.footer.set_message("Status posted {} \\o/".format(status.id))
self.close_overlay()

View File

@ -150,6 +150,10 @@ class Timeline(urwid.Columns):
return n
raise ValueError("Status with ID {} not found".format(id))
def focus_status(self, status):
index = self.get_status_index(status.id)
self.status_list.body.set_focus(index)
def update_status(self, status):
"""Overwrite status in list with the new instance and redraw."""
index = self.get_status_index(status.id)