Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 60235431FB6 for ; Sun, 17 Mar 2013 07:32:42 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pjzzo00TFYCu for ; Sun, 17 Mar 2013 07:32:42 -0700 (PDT) Received: from dkim1.fusionio.com (dkim1.fusionio.com [66.114.96.53]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E06B8431FAE for ; Sun, 17 Mar 2013 07:32:41 -0700 (PDT) Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim1.fusionio.com (Postfix) with ESMTP id C0D807C04D8 for ; Sun, 17 Mar 2013 08:32:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1363530759; bh=r/vn4zZaOJ02KoHebNJs5w87dPn2zhXz2ntMhY1eBVc=; h=From:To:References:In-Reply-To:Subject:Date; b=p19vtkHNpMzYrqGAYDzD7m3kPd70AL9/Kat7+MOevXG8iduBJD5Hagz9xPVZrBqna mHwU2nzs3+TxN7Ltmp8e7ZD44/wl4A6h4CB0VpQ9ngmX6zNU9opEFgCxvcOAbHkDLB ZEQ0aZKe10HjyAJGc12tcX4NMdwRDwcoSASRDvts= X-ASG-Debug-ID: 1363530759-03d6a52abf135e0001-ZmzXr9 Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx1.fusionio.com with ESMTP id NF7hAkAQRDlU6w2O (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Sun, 17 Mar 2013 08:32:39 -0600 (MDT) X-Barracuda-Envelope-From: clmason@fusionio.com Received: from localhost (67.247.72.189) by mail.fusionio.com (10.101.1.19) with Microsoft SMTP Server (TLS) id 8.3.83.0; Sun, 17 Mar 2013 08:32:38 -0600 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Chris Mason User-Agent: alot/0.3.4 To: Chris Mason , , Patrick Totzke References: <20130316184238.11801.82067@localhost.localdomain> In-Reply-To: <20130316184238.11801.82067@localhost.localdomain> Message-ID: <20130317143237.6912.75793@localhost.localdomain> Subject: [PATCH] alot: send batch keypresses back to urwid (v2) Date: Sun, 17 Mar 2013 10:32:37 -0400 X-ASG-Orig-Subj: [PATCH] alot: send batch keypresses back to urwid (v2) X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21] X-Barracuda-Start-Time: 1363530759 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-Bayes: INNOCENT GLOBAL 0.0990 1.0000 -1.3986 X-Barracuda-Spam-Score: 2.10 X-Barracuda-Spam-Status: No, SCORE=2.10 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=BSF_SC0_MV0035, BSF_SC0_SA550, BSF_SC0_SA_TO_FROM_ADDR_MATCH X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.125457 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_SC0_SA_TO_FROM_ADDR_MATCH Sender Address Matches Recipient Address 2.50 BSF_SC0_SA550 Custom Rule SA550 0.50 BSF_SC0_MV0035 Custom Rule BSF_SC0_MV0035 X-Mailman-Approved-At: Sun, 17 Mar 2013 16:42:40 -0700 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2013 14:32:42 -0000 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 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 =3D [] 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=3D'error') + def fire_one(ignored, cmdline): + return fire(ignored, cmdline, 1) = key =3D 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 =3D 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