unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] alot: send batch keypresses back to urwid
@ 2013-03-16 18:42 Chris Mason
  2013-03-17 14:32 ` [PATCH] alot: send batch keypresses back to urwid (v2) Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Mason @ 2013-03-16 18:42 UTC (permalink / raw)
  To: notmuch, Patrick Totzke

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?

Signed-off-by: Chris Mason <chris.mason@fusionio.com>

diff --git a/alot/ui.py b/alot/ui.py
index 5d4dd4a..b8ced29 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -119,12 +119,12 @@ 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)
@@ -147,7 +147,7 @@ class UI(object):
                             self.mainloop.remove_alarm(self._alarm)
                         self._alarm = self.mainloop.set_alarm_in(timeout, fire, 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-17 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-16 18:42 [PATCH] alot: send batch keypresses back to urwid Chris Mason
2013-03-17 14:32 ` [PATCH] alot: send batch keypresses back to urwid (v2) Chris Mason

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).