[Pkg-mozext-commits] [itsalltext] 281/459: * Fixed bug where AltGr would trigger <none> hot-key. * Added some missing named keys. * Bumped version # to 0.8.1

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository itsalltext.

commit f7d0146daa3ca173ee76bcee8fef184adcc00bfd
Author: docwhat at gerf.org <docwhat at gerf.org>
Date:   Thu Oct 4 10:18:52 2007 -0400

    * Fixed bug where AltGr would trigger <none> hot-key.
    * Added some missing named keys.
    * Bumped version # to 0.8.1
---
 Makefile                          |  2 +-
 src/chrome/content/itsalltext.js  | 52 ++++++++++++++++++++++++++++-----------
 src/chrome/content/preferences.js |  4 ++-
 3 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index f268ddd..c7c95e9 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ ZIP        := zip
 PROJNICK   := itsalltext
 PROJNAME   := "It's All Text!"
 ICONFILE   := src/chrome/content/icon.png
-VERSION    := 0.8.0
+VERSION    := 0.8.1
 
 
 # NOTE: do not create files or directories in here that have
diff --git a/src/chrome/content/itsalltext.js b/src/chrome/content/itsalltext.js
index b2b283c..1b452a9 100644
--- a/src/chrome/content/itsalltext.js
+++ b/src/chrome/content/itsalltext.js
@@ -551,11 +551,39 @@ var ItsAllText = function() {
                        event.keyCode
         ];
         marshal = marshal.join(':');
-        if (marshal === '0:0:0:0:0:0') {
-            return '';
-        } else {
-            return marshal;
-        }
+        return marshal;
+    };
+
+    that.keyMap = {
+        8   : 'Backspace',
+        9   : 'Tab',
+        13  : 'Enter',
+        19  : 'Break',
+        27  : 'Escape',
+        33  : 'PgUp',
+        34  : 'PgDn',
+        35  : 'End',
+        36  : 'Home',
+        37  : 'Left',
+        38  : 'Up',
+        39  : 'Right',
+        40  : 'Down',
+        45  : 'Insert',
+        46  : 'Delete',
+        112 : 'F1',
+        113 : 'F2',
+        114 : 'F3',
+        115 : 'F4',
+        116 : 'F5',
+        117 : 'F6',
+        118 : 'F7',
+        119 : 'F8',
+        120 : 'F9',
+        121 : 'F10',
+        122 : 'F11',
+        144 : 'Num Lock',
+        145 : 'Scroll Lock',
+        ''  : '<none>'
     };
 
     /**
@@ -578,16 +606,10 @@ var ItsAllText = function() {
             out.push('shift');
         }
         if (e[4] === '0') {
-            switch (c) {
-            case  8: out.push('Backspace'); break;
-            case  9: out.push('Tab'); break;
-            case 27: out.push('Escape'); break;
-            case 33: out.push('PgUp'); break;
-            case 34: out.push('PgDn'); break;
-            case 35: out.push('End'); break;
-            case 36: out.push('Home'); break;
-            case 46: out.push('Delete'); break;
-            default: out.push('code:'+c); break;
+            if (that.keyMap.hasOwnProperty(c)) {
+                out.push(that.keyMap[c]);
+            } else {
+                out.push('code:'+c);
             }
         } else {
             out.push(String.fromCharCode(e[4]).toUpperCase());
diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index 9406653..fcf7d34 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -44,7 +44,9 @@ function pref_editor_select() {
 function pref_grab(disp, e) {
     e.preventDefault();
     var km  = ItsAllText.marshalKeyEvent(e);
-    if (km === '0:0:0:0:0:8' ||   // Backspace
+    const empty_re = /:0:0$/;
+    if (empty_re.test(km)    ||   // Various Alt/Meta keys
+        km === '0:0:0:0:0:8' ||   // Backspace
         km === '0:0:0:0:0:27' ||  // Escape
         km === '0:0:0:0:0:46') {  // Del
         km = '';

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git



More information about the Pkg-mozext-commits mailing list