diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-08-25 19:17:15 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-08-25 19:17:15 +0100 |
commit | e441e1304f8d7dd2b7137eb5c6e0158ffa9c2086 (patch) | |
tree | 0e724840a8566001e899ff3ef95d194e69fa5982 /alot | |
parent | d9d8d4b02d84323a5568e90db38de39ba753f27a (diff) |
split ui.commandprompt into prompt and interpret
this allows hooks to easily call alot commands
via ui.interpret_commandline('yourcommand')
Diffstat (limited to 'alot')
-rw-r--r-- | alot/ui.py | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -155,12 +155,16 @@ class UI: history=self.commandprompthistory, ) if cmdline: - self.commandprompthistory.append(cmdline) - cmd = interpret_commandline(cmdline, mode) - if cmd: - self.apply_command(cmd) - else: - self.notify('invalid command') + self.interpret_commandline(cmdline) + + def interpret_commandline(self, cmdline): + mode = self.current_buffer.typename + self.commandprompthistory.append(cmdline) + cmd = interpret_commandline(cmdline, mode) + if cmd: + self.apply_command(cmd) + else: + self.notify('invalid command') def buffer_open(self, b): """ |