unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Chris Mason <chris.mason@fusionio.com>
To: <notmuch@notmuchmail.org>, Patrick Totzke <patricktotzke@gmail.com>
Subject: [PATCH] alot: send batch keypresses back to urwid
Date: Sat, 16 Mar 2013 14:42:38 -0400	[thread overview]
Message-ID: <20130316184238.11801.82067@localhost.localdomain> (raw)

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

             reply	other threads:[~2013-03-16 18:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-16 18:42 Chris Mason [this message]
2013-03-17 14:32 ` [PATCH] alot: send batch keypresses back to urwid (v2) Chris Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130316184238.11801.82067@localhost.localdomain \
    --to=chris.mason@fusionio.com \
    --cc=notmuch@notmuchmail.org \
    --cc=patricktotzke@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).