From 4a7f2511c739caff9764be059dd697fbf959fa3c Mon Sep 17 00:00:00 2001 From: Vadim Pisarev Date: Tue, 27 Jul 2021 09:22:59 -0400 Subject: [PATCH] Immediately remove unread tag from single-message threads --- alot/buffers/thread.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/alot/buffers/thread.py b/alot/buffers/thread.py index 4efd7f13d..845d20efa 100644 --- a/alot/buffers/thread.py +++ b/alot/buffers/thread.py @@ -107,11 +107,18 @@ def render(self, size, focus=False): if settings.get('auto_remove_unread'): logging.debug('Tbuffer: auto remove unread tag from msg?') + msg = self.get_selected_message() mid = msg.get_message_id() - focus_pos = self.body.get_focus()[1] - summary_pos = (self.body.get_focus()[1][0], (0,)) - cursor_on_non_summary = (focus_pos != summary_pos) + + if self.message_count > 1: + focus_pos = self.body.get_focus()[1] + summary_pos = (self.body.get_focus()[1][0], (0,)) + cursor_on_non_summary = (focus_pos != summary_pos) + else: + # Immediately remove unread tag from single-message threads + cursor_on_non_summary = True + if cursor_on_non_summary: if mid not in self._auto_unread_dont_touch_mids: if 'unread' in msg.get_tags():