summaryrefslogtreecommitdiff
path: root/alot/ui.py
diff options
context:
space:
mode:
Diffstat (limited to 'alot/ui.py')
-rw-r--r--alot/ui.py48
1 files changed, 29 insertions, 19 deletions
diff --git a/alot/ui.py b/alot/ui.py
index 6f6d29ed..f492c2bd 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -120,26 +120,36 @@ class UI(object):
key = keys[0]
self.input_queue.append(key)
keyseq = ' '.join(self.input_queue)
- cmdline = settings.get_keybinding(self.mode, keyseq)
- if cmdline:
+ candidates = settings.get_mapped_input_keysequences(self.mode,
+ prefix=keyseq)
+ if keyseq in candidates:
+ # case: current input queue is a mapped keysequence
+ # get binding and interpret it if non-null
+ cmdline = settings.get_keybinding(self.mode, keyseq)
+ if cmdline:
+ clear()
+ logging.debug("cmdline: '%s'" % cmdline)
+ # move keys are always passed
+ if cmdline.startswith('move '):
+ movecmd = cmdline[5:].rstrip()
+ logging.debug("GOT MOVE: '%s'" % movecmd)
+ if movecmd in ['up', 'down', 'page up', 'page down']:
+ return [movecmd]
+ elif not self._locked:
+ try:
+ self.apply_commandline(cmdline)
+ except CommandParseError, e:
+ self.notify(e.message, priority='error')
+ elif not candidates:
+ # case: no sequence with prefix keyseq is mapped
+ # just clear the input queue
clear()
- logging.debug("cmdline: '%s'" % cmdline)
- # move keys are always passed
- if cmdline.startswith('move '):
- movecmd = cmdline[5:].rstrip()
- logging.debug("GOT MOVE: '%s'" % movecmd)
- if movecmd in ['up', 'down', 'page up', 'page down']:
- return [movecmd]
- elif not self._locked:
- try:
- self.apply_commandline(cmdline)
- except CommandParseError, e:
- self.notify(e.message, priority='error')
-
- timeout = float(settings.get('input_timeout'))
- if self._alarm is not None:
- self.mainloop.remove_alarm(self._alarm)
- self._alarm = self.mainloop.set_alarm_in(timeout, clear)
+ else:
+ # case: some sequences with proper prefix keyseq is mapped
+ timeout = float(settings.get('input_timeout'))
+ if self._alarm is not None:
+ self.mainloop.remove_alarm(self._alarm)
+ self._alarm = self.mainloop.set_alarm_in(timeout, clear)
# update statusbar
self.update()