From: Chris Mason Date: Sat, 16 Mar 2013 18:42:38 +0000 (+2000) Subject: [PATCH] alot: send batch keypresses back to urwid X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=33794dae5a4014e7e3d19b01b9deb73fb267217a;p=notmuch-archives.git [PATCH] alot: send batch keypresses back to urwid --- diff --git a/01/63f1b433b4a2ce88f617a6c1ef0c9a2a6f61a4 b/01/63f1b433b4a2ce88f617a6c1ef0c9a2a6f61a4 new file mode 100644 index 000000000..5ab1fee5b --- /dev/null +++ b/01/63f1b433b4a2ce88f617a6c1ef0c9a2a6f61a4 @@ -0,0 +1,124 @@ +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 2F369431FB6 + for ; Sat, 16 Mar 2013 11:51:48 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.8 +X-Spam-Level: +X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + RCVD_IN_DNSWL_LOW=-0.7] 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 c6miQkZoUTYX for ; + Sat, 16 Mar 2013 11:51:47 -0700 (PDT) +X-Greylist: delayed 546 seconds by postgrey-1.32 at olra; + Sat, 16 Mar 2013 11:51:47 PDT +Received: from dkim2.fusionio.com (dkim2.fusionio.com [66.114.96.54]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A5351431FAE + for ; Sat, 16 Mar 2013 11:51:47 -0700 (PDT) +Received: from mx2.fusionio.com (unknown [10.101.1.160]) + by dkim2.fusionio.com (Postfix) with ESMTP id A00B59A0402 + for ; Sat, 16 Mar 2013 12:42:40 -0600 (MDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; + s=default; t=1363459360; + bh=VvxVT71Srpf7Vicmvcee+EAFTKrZkNPGea6TJsHvUQU=; + h=To:From:Subject:Date; + b=A82sndzM/hqDMl+LPG3R10Qst/af15ISmtrg638ZcLwC9QBvk35jHB+X9K8KteISQ + g4DBBU65WiULs2aQaR60iXxxCivnY0GclKhATGJ98/jGxNaJ7HYQ/W1rzcHWNiBI00 + uyPy4Ivokme9wAQnFm65pB1JzFOSLlilXs2LiL0E= +X-ASG-Debug-ID: 1363459359-0421b5172c02670001-ZmzXr9 +Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) + by mx2.fusionio.com with ESMTP id CwavD8drQIqkXMCf + (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); + Sat, 16 Mar 2013 12:42: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; + Sat, 16 Mar 2013 12:42:39 -0600 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +To: , Patrick Totzke +Message-ID: <20130316184238.11801.82067@localhost.localdomain> +From: Chris Mason +User-Agent: alot/0.3.4 +Subject: [PATCH] alot: send batch keypresses back to urwid +Date: Sat, 16 Mar 2013 14:42:38 -0400 +X-ASG-Orig-Subj: [PATCH] alot: send batch keypresses back to urwid +X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21] +X-Barracuda-Start-Time: 1363459359 +X-Barracuda-Encrypted: AES128-SHA +X-Barracuda-URL: http://10.101.1.181:8000/cgi-mod/mark.cgi +X-Virus-Scanned: by bsmtpd at fusionio.com +X-Barracuda-Spam-Score: 0.00 +X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of + TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= +X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.125378 + Rule breakdown below + pts rule name description + ---- ---------------------- + -------------------------------------------------- +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: Sat, 16 Mar 2013 18:51:48 -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? + +Signed-off-by: Chris Mason + +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 =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', 'mo= +ve 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 =3D 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