summaryrefslogtreecommitdiff
path: root/alot/buffers.py
diff options
context:
space:
mode:
Diffstat (limited to 'alot/buffers.py')
-rw-r--r--alot/buffers.py14
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)