Re: notmuch-tree display
[notmuch-archives.git] / f2 / 6f7408ce22edf2ff8d2e55a9c9cb8e18c4da41
1 Return-Path: <clmason@fusionio.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 60235431FB6\r
6         for <notmuch@notmuchmail.org>; Sun, 17 Mar 2013 07:32:42 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.1\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id pjzzo00TFYCu for <notmuch@notmuchmail.org>;\r
17         Sun, 17 Mar 2013 07:32:42 -0700 (PDT)\r
18 Received: from dkim1.fusionio.com (dkim1.fusionio.com [66.114.96.53])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id E06B8431FAE\r
22         for <notmuch@notmuchmail.org>; Sun, 17 Mar 2013 07:32:41 -0700 (PDT)\r
23 Received: from mx1.fusionio.com (unknown [10.101.1.160])\r
24         by dkim1.fusionio.com (Postfix) with ESMTP id C0D807C04D8\r
25         for <notmuch@notmuchmail.org>; Sun, 17 Mar 2013 08:32:39 -0600 (MDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com;\r
27         s=default; t=1363530759;\r
28         bh=r/vn4zZaOJ02KoHebNJs5w87dPn2zhXz2ntMhY1eBVc=;\r
29         h=From:To:References:In-Reply-To:Subject:Date;\r
30         b=p19vtkHNpMzYrqGAYDzD7m3kPd70AL9/Kat7+MOevXG8iduBJD5Hagz9xPVZrBqna\r
31         mHwU2nzs3+TxN7Ltmp8e7ZD44/wl4A6h4CB0VpQ9ngmX6zNU9opEFgCxvcOAbHkDLB\r
32         ZEQ0aZKe10HjyAJGc12tcX4NMdwRDwcoSASRDvts=\r
33 X-ASG-Debug-ID: 1363530759-03d6a52abf135e0001-ZmzXr9\r
34 Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21])\r
35         by mx1.fusionio.com with ESMTP id NF7hAkAQRDlU6w2O\r
36         (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO);\r
37         Sun, 17 Mar 2013 08:32:39 -0600 (MDT)\r
38 X-Barracuda-Envelope-From: clmason@fusionio.com\r
39 Received: from localhost (67.247.72.189) by mail.fusionio.com (10.101.1.19)\r
40         with Microsoft SMTP Server (TLS) id 8.3.83.0;\r
41         Sun, 17 Mar 2013 08:32:38 -0600\r
42 Content-Type: text/plain; charset="utf-8"\r
43 MIME-Version: 1.0\r
44 Content-Transfer-Encoding: quoted-printable\r
45 From: Chris Mason <chris.mason@fusionio.com>\r
46 User-Agent: alot/0.3.4\r
47 To: Chris Mason <chris.mason@fusionio.com>, <notmuch@notmuchmail.org>, Patrick\r
48         Totzke <patricktotzke@gmail.com>\r
49 References: <20130316184238.11801.82067@localhost.localdomain>\r
50 In-Reply-To: <20130316184238.11801.82067@localhost.localdomain>\r
51 Message-ID: <20130317143237.6912.75793@localhost.localdomain>\r
52 Subject: [PATCH] alot: send batch keypresses back to urwid (v2)\r
53 Date: Sun, 17 Mar 2013 10:32:37 -0400\r
54 X-ASG-Orig-Subj: [PATCH] alot: send batch keypresses back to urwid (v2)\r
55 X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21]\r
56 X-Barracuda-Start-Time: 1363530759\r
57 X-Barracuda-Encrypted: AES128-SHA\r
58 X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi\r
59 X-Virus-Scanned: by bsmtpd at fusionio.com\r
60 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0990 1.0000 -1.3986\r
61 X-Barracuda-Spam-Score: 2.10\r
62 X-Barracuda-Spam-Status: No,\r
63         SCORE=2.10 using per-user scores of TAG_LEVEL=1000.0\r
64         QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=BSF_SC0_MV0035,\r
65         BSF_SC0_SA550, BSF_SC0_SA_TO_FROM_ADDR_MATCH\r
66 X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.125457\r
67         Rule breakdown below\r
68         pts rule name              description\r
69         ---- ----------------------\r
70         --------------------------------------------------\r
71         0.50 BSF_SC0_SA_TO_FROM_ADDR_MATCH Sender Address Matches Recipient\r
72         Address 2.50 BSF_SC0_SA550          Custom Rule SA550\r
73         0.50 BSF_SC0_MV0035         Custom Rule BSF_SC0_MV0035\r
74 X-Mailman-Approved-At: Sun, 17 Mar 2013 16:42:40 -0700\r
75 X-BeenThere: notmuch@notmuchmail.org\r
76 X-Mailman-Version: 2.1.13\r
77 Precedence: list\r
78 List-Id: "Use and development of the notmuch mail system."\r
79         <notmuch.notmuchmail.org>\r
80 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
81         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
82 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
83 List-Post: <mailto:notmuch@notmuchmail.org>\r
84 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
85 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
86         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
87 X-List-Received-Date: Sun, 17 Mar 2013 14:32:42 -0000\r
88 \r
89 Looks like the urwid code is sending us arrays of [ 'j', 'j', 'j' ... ]\r
90 when I hold down the key, but alot is only acting on one of them.\r
91  =\r
92 \r
93 This changes the fire routine to send back all the keys that were sent\r
94 to us.  It may be a horrible idea, and I'm not sure if urwid always sends us\r
95 arrays of the same thing.\r
96 \r
97 But it's dramatically faster, so how can it be bad?  V2 catches the\r
98 second caller of fire()\r
99 \r
100 Signed-off-by: Chris Mason <chris.mason@fusionio.com>\r
101 \r
102 diff --git a/alot/ui.py b/alot/ui.py\r
103 index 3593c60..cdc66a6 100644\r
104 --- a/alot/ui.py\r
105 +++ b/alot/ui.py\r
106 @@ -119,18 +119,20 @@ class UI(object):\r
107                  self.input_queue =3D []\r
108                  self.update()\r
109  =\r
110 \r
111 -            def fire(ignored, cmdline):\r
112 +            def fire(ignored, cmdline, count):\r
113                  clear()\r
114                  logging.debug("cmdline: '%s'" % cmdline)\r
115                  # move keys are always passed\r
116                  if cmdline in ['move up', 'move down', 'move page up',\r
117                                 'move page down']:\r
118 -                    return [cmdline[5:]]\r
119 +                    return [cmdline[5:]] * count\r
120                  elif not self._locked:\r
121                      try:\r
122                          self.apply_commandline(cmdline)\r
123                      except CommandParseError, e:\r
124                          self.notify(e.message, priority=3D'error')\r
125 +            def fire_one(ignored, cmdline):\r
126 +                return fire(ignored, cmdline, 1)\r
127  =\r
128 \r
129              key =3D keys[0]\r
130              self.input_queue.append(key)\r
131 @@ -147,9 +149,9 @@ class UI(object):\r
132                          if self._alarm is not None:\r
133                              self.mainloop.remove_alarm(self._alarm)\r
134                          self._alarm =3D self.mainloop.set_alarm_in(\r
135 -                            timeout, fire, cmdline)\r
136 +                            timeout, fire_one, cmdline)\r
137                      else:\r
138 -                        return fire(self.mainloop, cmdline)\r
139 +                        return fire(self.mainloop, cmdline, len(keys))\r
140  =\r
141 \r
142              elif not candidates:\r
143                  # case: no sequence with prefix keyseq is mapped\r