Looks like the urwid code is sending us arrays of [ 'j', 'j', 'j' ... ] when I hold down the key, but alot is only acting on one of them. This changes the fire routine to send back all the keys that were sent to us. It may be a horrible idea, and I'm not sure if urwid always sends us arrays of the same thing. But it's dramatically faster, so how can it be bad? V2 catches the second caller of fire() Signed-off-by: Chris Mason <chris.mason@fusionio.com> diff --git a/alot/ui.py b/alot/ui.py index 3593c60..cdc66a6 100644 --- a/alot/ui.py +++ b/alot/ui.py @@ -119,18 +119,20 @@ class UI(object): self.input_queue = [] self.update() - def fire(ignored, cmdline): + def fire(ignored, cmdline, count): clear() logging.debug("cmdline: '%s'" % cmdline) # move keys are always passed if cmdline in ['move up', 'move down', 'move page up', 'move page down']: - return [cmdline[5:]] + return [cmdline[5:]] * count elif not self._locked: try: self.apply_commandline(cmdline) except CommandParseError, e: self.notify(e.message, priority='error') + def fire_one(ignored, cmdline): + return fire(ignored, cmdline, 1) key = keys[0] self.input_queue.append(key) @@ -147,9 +149,9 @@ class UI(object): if self._alarm is not None: self.mainloop.remove_alarm(self._alarm) self._alarm = self.mainloop.set_alarm_in( - timeout, fire, cmdline) + timeout, fire_one, cmdline) else: - return fire(self.mainloop, cmdline) + return fire(self.mainloop, cmdline, len(keys)) elif not candidates: # case: no sequence with prefix keyseq is mapped