summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2013-02-02 11:00:30 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2013-03-03 13:48:21 +0000
commitdaacc6b8f46a5370e8d2ddd4de69289977dd9eb0 (patch)
treee5df9b94f947faaa7d377c51e7355f7f5d3db49d /alot
parentfc2bdd250dde95de7d599ce4ed48b351fcbfd1a3 (diff)
add command to move focus in thread tree
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/thread.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 847659fb..838d5737 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -828,6 +828,32 @@ class OpenAttachmentCommand(Command):
else:
ui.notify('unknown mime type')
+@registerCommand(MODE, 'focus', arguments=[
+ (['direction'], {'help':'direction','nargs': '+'})],
+ help='move focus depending on the thread tree structure',
+)
+class MoveFocusCommand(Command):
+ def __init__(self, direction=None):
+ self._direction = ' '.join(direction)
+
+ def apply(self, ui):
+ logging.debug(self._direction)
+ tbox = ui.current_buffer.body
+ if self._direction == 'parent':
+ tbox.focus_parent()
+ elif self._direction == 'first child':
+ tbox.focus_first_child()
+ elif self._direction == 'last child':
+ tbox.focus_last_child()
+ elif self._direction == 'next sibling':
+ tbox.focus_next_sibling()
+ elif self._direction == 'previous sibling':
+ tbox.focus_prev_sibling()
+ elif self._direction == 'next':
+ tbox.focus_next()
+ elif self._direction == 'previous':
+ tbox.focus_prev()
+ tbox.refresh()
@registerCommand(MODE, 'select')
class ThreadSelectCommand(Command):