diff options
author | William Erik Baxter <web@superscript.com> | 2012-11-22 16:19:30 -0500 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-02-19 10:06:28 +0000 |
commit | ec63e9b899af1361e0da48d9031f77eccb87d3ea (patch) | |
tree | f35980b96bd3fed30620f4e7cd46c7a9c7d3f0ab /alot/commands/globals.py | |
parent | c765ebd6041a845a800cc9fd30705102ae2d040f (diff) |
Implement move commands in globals.py. Add --redraw for bclose.
Diffstat (limited to 'alot/commands/globals.py')
-rw-r--r-- | alot/commands/globals.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 1cf78ca4..22bbae69 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -338,11 +338,13 @@ class CallCommand(Command): @registerCommand(MODE, 'bclose', arguments=[ + (['--redraw'], {'action': BooleanAction, 'help':'redraw current buffer \ + after command has finished'}), (['--force'], {'action': 'store_true', 'help': 'never ask for confirmation'})]) class BufferCloseCommand(Command): """close a buffer""" - def __init__(self, buffer=None, force=False, **kwargs): + def __init__(self, buffer=None, force=False, redraw=True, **kwargs): """ :param buffer: the buffer to close or None for current :type buffer: `alot.buffers.Buffer` @@ -351,6 +353,7 @@ class BufferCloseCommand(Command): """ self.buffer = buffer self.force = force + self.redraw = redraw Command.__init__(self, **kwargs) @inlineCallbacks @@ -374,7 +377,7 @@ class BufferCloseCommand(Command): logging.info('not closing last remaining buffer as ' 'global.quit_on_last_bclose is set to False') else: - ui.buffer_close(self.buffer) + ui.buffer_close(self.buffer,self.redraw) @registerCommand(MODE, 'bprevious', forced={'offset': -1}, @@ -779,6 +782,21 @@ class ComposeCommand(Command): refocus=False) ui.apply_command(cmd) +@registerCommand(MODE, 'move', help='move focus in current buffer', + arguments = [(['movement'], {'nargs':argparse.REMAINDER, + 'help':'up, down, page up, page down'})] +) +class MoveCommand(Command): + """move in widget""" + def __init__(self, movement=None, **kwargs): + if movement is None: + self.movement = '' + else: + self.movement = ' '.join(movement) + Command.__init__(self, **kwargs) + + def apply(self, ui): + ui.mainloop.process_input([self.movement]) class CommandSequenceCommand(Command): """Meta-Command that just applies a sequence of given Commands in order""" |