summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-08-25 19:17:15 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-08-25 19:17:15 +0100
commite441e1304f8d7dd2b7137eb5c6e0158ffa9c2086 (patch)
tree0e724840a8566001e899ff3ef95d194e69fa5982 /alot
parentd9d8d4b02d84323a5568e90db38de39ba753f27a (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.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/alot/ui.py b/alot/ui.py
index e8b7c5fd..d90fc544 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -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):
"""