diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2013-01-19 15:22:36 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-01-19 15:22:36 +0000 |
commit | 6b5f1a8bf68eecf4364f97c71ec177cf715c081e (patch) | |
tree | 9ebd2d95a81798ed84711b1d44b5051b48f7663d /alot/ui.py | |
parent | 576b6061a5074e6b6aad03621c5aec787d456c2d (diff) | |
parent | 69f0cf8dc4fe860eb5ad9d6f71fbee9b611fca00 (diff) |
Merge branch '0.3.3-fix-nowait-547'
Diffstat (limited to 'alot/ui.py')
-rw-r--r-- | alot/ui.py | 48 |
1 files changed, 29 insertions, 19 deletions
@@ -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() |