diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2013-03-02 23:53:13 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-03-03 13:50:19 +0000 |
commit | c841d22dd703978109a6fa855dc22b444a2896a9 (patch) | |
tree | 99d50ea259d70d2bc087759d2f5d76de3336544a /alot/buffers.py | |
parent | 60fc46c2e5d5d7ae8d447a86abea0cde7197408a (diff) |
make thread.move parent message-based
Diffstat (limited to 'alot/buffers.py')
-rw-r--r-- | alot/buffers.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/alot/buffers.py b/alot/buffers.py index 0c5d09a6..ac91f30f 100644 --- a/alot/buffers.py +++ b/alot/buffers.py @@ -342,6 +342,9 @@ class ThreadBuffer(Buffer): self.body = TreeBox(self._nested_tree) self.message_count = self.thread.get_total_messages() + def get_selected_mid(self): + return self.body.get_focus()[1][0] + def get_selected_messagetree(self): """returns currently focussed :class:`MessageTree`""" return self._nested_tree[self.body.get_focus()[1][:1]] @@ -367,9 +370,20 @@ class ThreadBuffer(Buffer): def get_focus(self): return self.body.get_focus() + def get_focus_position(self): + return self._sanitize_position((self.get_selected_mid(),)) + def focus_first(self): self.body.set_focus(self._nested_tree.root) + def _sanitize_position(self, pos): + return self._nested_tree._sanitize_position(pos, self._nested_tree._tree) + + def focus_parent(self): + mid = self.get_selected_mid() + newpos = self._tree.parent_position(mid) + self.body.set_focus(self._sanitize_position((newpos,))) + def expand(self, msgpos): MT = self._tree[msgpos] MT.expand(MT.root) |