From 9163c1a5f5436d66c912b67e149b2812e37faa0f 2014-03-20 05:29:31
From: Paul Ivanov <pi@berkeley.edu>
Date: 2014-03-20 05:29:31
Subject: [PATCH] really fix the '-' key shortcuts now

---

diff --git a/IPython/html/static/base/js/keyboard.js b/IPython/html/static/base/js/keyboard.js
index 8c56d7b..a490a76 100644
--- a/IPython/html/static/base/js/keyboard.js
+++ b/IPython/html/static/base/js/keyboard.js
@@ -43,12 +43,12 @@ IPython.keyboard = (function (IPython) {
     
     // These apply to Firefox and Opera
     var _mozilla_keycodes = {
-        '; :': 59, '= +': 61, '- _': 173, 'minus': 173, 'meta': 224
+        '; :': 59, '= +': 61, '- _': 173, 'meta': 224
     };
     
     // This apply to Webkit and IE
     var _ie_keycodes = {
-        '; :': 186, '= +': 187, '- _': 189, 'minus': 189 
+        '; :': 186, '= +': 187, '- _': 189
     };
     
     var browser = IPython.utils.browser[0];
@@ -88,7 +88,7 @@ IPython.keyboard = (function (IPython) {
         // 3. Sort '-' separated modifiers into the order alt-ctrl-meta-shift
         // 4. Normalize keys
         shortcut = shortcut.toLowerCase().replace('cmd', 'meta');
-        shortcut = shortcut.replace(/-$/, 'minus');  // catch shortcuts using '-' key
+        shortcut = shortcut.replace(/-$/, '_');  // catch shortcuts using '-' key
         var values = shortcut.split("-");
         if (values.length === 1) {
             return normalize_key(values[0]);
@@ -104,6 +104,7 @@ IPython.keyboard = (function (IPython) {
         // Convert a shortcut (shift-r) to a jQuery Event object
         type = type || 'keydown';
         shortcut = normalize_shortcut(shortcut);
+        shortcut = shortcut.replace(/-$/, '_');  // catch shortcuts using '-' key
         var values = shortcut.split("-");
         var modifiers = values.slice(0,-1);
         var key = values[values.length-1];
diff --git a/IPython/html/static/notebook/js/quickhelp.js b/IPython/html/static/notebook/js/quickhelp.js
index 804490a..84f825f 100644
--- a/IPython/html/static/notebook/js/quickhelp.js
+++ b/IPython/html/static/notebook/js/quickhelp.js
@@ -73,7 +73,7 @@ var IPython = (function (IPython) {
 
     var special_case = { pageup: "PageUp", pagedown: "Page Down", 'minus': '-' };
     var prettify = function (s) {
-        s = s.replace('--', '-'); // catch shortcuts using '-' key
+        s = s.replace(/-$/, 'minus'); // catch shortcuts using '-' key
         var keys = s.split('-');
         var k, i;
         for (i in keys) {