[imp] Patch to allow ctrl-enter and escape

Michael Wing marsfurrycreature at gmail.com
Wed Aug 1 14:41:44 UTC 2012


I asked about this a few weeks back, and just got around to implementing
it.  This patch allows the Escape key to cancel, and the CTRL-Return to
send when using dimp, similar to how other desktop MUAs work.

Michael

--- compose-dimp.js.orig        2012-08-01 09:39:40.000000000 -0500
+++ compose-dimp.js     2012-08-01 09:31:45.000000000 -0500
@@ -1023,6 +1023,25 @@
         parentfunc(e);
     },

+
+    /* Keydown event handler */
+    keydownHandler: function(e)
+    {
+        kc = e.keyCode || e.charCode;
+        switch (kc) {
+        case Event.KEY_ESC:
+            this.confirmCancel();
+           break;
+        case Event.KEY_RETURN:
+            if (e.ctrlKey) {
+               if (!this.disabled) {
+                  this.uniqueSubmit('sendMessage');
+               }
+            }
+       }
+    },
+
     changeHandler: function(e)
     {
         var elt = e.element(),
@@ -1097,6 +1116,9 @@
             document.observe('SpellChecker:error',
this._onSpellCheckError.bind(this));
         }

+        document.observe('keydown',
this.keydownHandler.bindAsEventListener(this));
+
         /* Create sent-mail list. */
         if (DIMP.conf_compose.flist) {
             this.createPopdown('sm', {
@@ -1166,3 +1188,4 @@
         break;
     }
 });
+


More information about the imp mailing list