From: Simon Tatham Date: Sun, 10 Dec 2023 15:32:16 +0000 (+0000) Subject: Fix missing screen refresh when new posts arrive. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=0dcf6e92ba0a44524a127832d09203ab4d506afc;p=mastodonochrome.git Fix missing screen refresh when new posts arrive. The rework of resize handling had the accidental side effect that when the self-pipe from the stream-watching thread signals us, we do call extend_future() on our feeds, but we _don't_ loop back round to the screen redraw, so that if the user is sitting in their home timeline, the bottom line of the screen doesn't update to show that new stuff is available. --- diff --git a/cursesclient.py b/cursesclient.py index 3e8c0c0..cde2d89 100644 --- a/cursesclient.py +++ b/cursesclient.py @@ -129,12 +129,12 @@ class CursesUI(client.Client): rfds_in.append(sp.rfd) rfds_out, _, _ = select.select(rfds_in, [], []) rfds_out = set(rfds_out) - resized = False + activity = False for (sp, handler, _) in self.selfpipes: if sp.rfd in rfds_out and sp.check(): if handler(): - resized = True - if resized: + activity = True + if activity: return None if 0 in rfds_out: return self.get_wch() @@ -236,20 +236,18 @@ class CursesUI(client.Client): self.clear() self.activity_stack[-1].render() self.scr.refresh() - while True: - ch = self.get_input() - if ch is not None: - break - if self.resized: - self.resized = False - ch = curses.KEY_RESIZE - break + + ch = self.get_input() + if ch is None and self.resized: + self.resized = False + ch = curses.KEY_RESIZE + if ch == ctrl('['): if self.activity_stack[-1] is not self.escape_menu: self.activity_stack.append(self.escape_menu) elif ch == curses.KEY_RESIZE: self.scr_h, self.scr_w = self.scr.getmaxyx() - else: + elif ch is not None: result = self.activity_stack[-1].handle_key(ch) if result == 'quit': if len(self.activity_stack) > 1: