diff options
author | Christopher Schwardt <nookieman@gmx.de> | 2012-11-07 22:49:03 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-02-19 18:43:16 +0000 |
commit | e823e47b150aff4a1939e8cfddefebf699ab301d (patch) | |
tree | 2efe04e17eaa462362c19947c715369ce3cf8f3d /alot/ui.py | |
parent | ecf5a504019b8ed57a903332e6f256225519297e (diff) |
add repeat command to make the same action again
The UI object now saves the last executed command (except for
RepeatCommands themselves and Promt- and FlushCommands, since they are
not user invoked, intended actions). The RepeatCommand then applies the
stored command again.
This is comparable to the . in vim, so I would recommend you add this
line to your config ;)
. = repeat
Diffstat (limited to 'alot/ui.py')
-rw-r--r-- | alot/ui.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -10,6 +10,9 @@ from buffers import BufferlistBuffer from commands import commandfactory from alot.commands import CommandParseError from alot.commands.globals import CommandSequenceCommand +from alot.commands.globals import FlushCommand +from alot.commands.globals import PromptCommand +from alot.commands.globals import RepeatCommand from alot.helper import string_decode from alot.helper import split_commandline from alot.widgets.globals import CompleteEdit @@ -37,6 +40,8 @@ class UI(object): """history of the command line prompt""" input_queue = [] """stores partial keyboard input""" + last_command = None + """saves the last executed command""" def __init__(self, dbman, initialcmd): """ @@ -169,6 +174,10 @@ class UI(object): else: cmd = CommandSequenceCommand(cmdlist) self.apply_command(cmd) + if not isinstance(cmd, RepeatCommand) and \ + not isinstance(cmd, PromptCommand) and \ + not isinstance(cmd, FlushCommand): + self.last_command = cmd def _unhandeled_input(self, key): """ |