diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2013-03-16 16:54:11 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-04-21 16:22:22 +0100 |
commit | 1f87cbb522cf1edb590e2d23bbeefb2322211bcc (patch) | |
tree | ae132f9cca2c7485aa9204547a011a96da134ddc | |
parent | f0b70be60168d1671ee95f9ec6cfc0de3bc315c3 (diff) |
implement autorm-unread
this reintroduces the automatic removal of 'unread' tag.
Instead of doing it when unfolding a message, it is now
done whenever the cursor us moved to a non-summary part
of the displayed message.
Also, it is dependant on the (new) config option 'auto_remove_unread'.
-rw-r--r-- | alot/buffers.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/alot/buffers.py b/alot/buffers.py index 3fa4c06d..5336864a 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -351,6 +351,26 @@ class ThreadBuffer(Buffer): self.body = TreeBox(self._nested_tree) self.message_count = self.thread.get_total_messages() + + def render(self,size, focus=False): + if settings.get('auto_remove_unread'): + logging.debug('Tbuffer: autorm unread?') + msg = self.get_selected_message() + 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 cursor_on_non_summary: + if 'unread' in msg.get_tags(): + logging.debug('Tbuffer: removing unread') + msg.remove_tags(['unread']) + self.ui.apply_command(commands.globals.FlushCommand()) + else: + logging.debug('Tbuffer: nope, already read') + else: + logging.debug('Tbuffer: nope, cursor still on summary') + return self.body.render(size, focus) + + def get_selected_mid(self): """returns Message ID of focussed message""" return self.body.get_focus()[1][0] |