diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-04 22:38:14 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-04 22:38:14 +0100 |
commit | eda41d8f5129e2b13c4e76b51c488bf0b66b43e8 (patch) | |
tree | ca6402b7da5bd4ad42af9cfa8b6ee14463912aa9 /alot | |
parent | 52bfe9b87e105534baf2c32f1bcf423c4b665f77 (diff) |
add move command
Diffstat (limited to 'alot')
-rw-r--r-- | alot/command.py | 13 | ||||
-rw-r--r-- | alot/defaults/alot.rc | 7 | ||||
-rw-r--r-- | alot/widgets.py | 1 |
3 files changed, 18 insertions, 3 deletions
diff --git a/alot/command.py b/alot/command.py index 0b77d814..fdf771d8 100644 --- a/alot/command.py +++ b/alot/command.py @@ -1057,6 +1057,16 @@ class TaglistSelectCommand(Command): ui.apply_command(cmd) +class MoveCommand(Command): + def __init__(self, direction, **kwargs): + Command.__init__(self, **kwargs) + self.direction = direction + + def apply(self, ui): + if self.direction in ['up', 'down', 'left', 'right', 'page down']: + ui.keypress(self.direction) + + COMMANDS = { 'search': { 'refine': (RefineCommand, {}), @@ -1093,6 +1103,7 @@ COMMANDS = { 'toggleheaders': (ToggleHeaderCommand, {}), }, 'global': { + 'move': (MoveCommand, {}), 'bnext': (BufferFocusCommand, {'offset': 1}), 'bprevious': (BufferFocusCommand, {'offset': -1}), 'bufferlist': (OpenBufferlistCommand, {}), @@ -1161,6 +1172,8 @@ def interpret_commandline(cmdline, mode): if cmd == 'search': return commandfactory(cmd, mode=mode, query=params) + if cmd == 'move': + return commandfactory(cmd, mode=mode, direction=params) elif cmd == 'compose': h = {} if params: diff --git a/alot/defaults/alot.rc b/alot/defaults/alot.rc index 1829b0f2..26cf1d05 100644 --- a/alot/defaults/alot.rc +++ b/alot/defaults/alot.rc @@ -63,13 +63,14 @@ initial_command = search tag:inbox AND NOT tag:killed complete_matching_abook_only = False [urwid-maps] -j = cursor down -k = cursor up -' ' = cursor page down enter = select esc = cancel [global-maps] +j = move down +k = move up +' ' = move page down + @ = refresh I = search tag:inbox AND NOT tag:killed L = taglist diff --git a/alot/widgets.py b/alot/widgets.py index 2f00bf08..b405a435 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -212,6 +212,7 @@ class CompleteEdit(urwid.Edit): def keypress(self, size, key): cmd = command_map[key] # if we tabcomplete + logging.debug((key,cmd)) if cmd in ['next selectable', 'prev selectable'] and self.completer: # if not already in completion mode if not self.completions: |