##// END OF EJS Templates
prettify combo keyboard shortcuts
Paul Ivanov -
Show More
@@ -79,7 +79,7 var IPython = (function (IPython) {
79 79 half = ~~(n/2); // Truncate :)
80 80 for (i=0; i<half; i++) {
81 81 help = command_shortcuts[i]['help'];
82 shortcut = shortcut_name(command_shortcuts[i]['shortcut']);
82 shortcut = prettify(command_shortcuts[i]['shortcut']);
83 83 cmd_col1.append($('<div>').addClass('quickhelp').
84 84 append($('<span/>').addClass('shortcut_key').text(shortcut)).
85 85 append($('<span/>').addClass('shortcut_descr').text(' : ' + help))
@@ -87,7 +87,7 var IPython = (function (IPython) {
87 87 };
88 88 for (i=half; i<n; i++) {
89 89 help = command_shortcuts[i]['help'];
90 shortcut = shortcut_name(command_shortcuts[i]['shortcut']);
90 shortcut = prettify(command_shortcuts[i]['shortcut']);
91 91 cmd_col2.append($('<div>').addClass('quickhelp').
92 92 append($('<span/>').addClass('shortcut_key').text(shortcut)).
93 93 append($('<span/>').addClass('shortcut_descr').text(' : ' + help))
@@ -99,8 +99,15 var IPython = (function (IPython) {
99 99 }
100 100
101 101 var special_case = { pageup: "PageUp", pagedown: "Page Down" };
102 var shortcut_name = function (s) {
103 return ( special_case[s] ? special_case[s] : s.charAt(0).toUpperCase() + s.slice(1) );
102 var prettify = function (s) {
103 var keys = s.split('+');
104 var k, i;
105 for (i in keys) {
106 k = keys[i];
107 if ( k.length == 1 ) continue; // leave individual keys lower-cased
108 keys[i] = ( special_case[k] ? special_case[k] : k.charAt(0).toUpperCase() + k.slice(1) );
109 }
110 return keys.join('-');
104 111
105 112
106 113 };
@@ -119,7 +126,7 var IPython = (function (IPython) {
119 126 half = ~~(n/2); // Truncate :)
120 127 for (i=0; i<half; i++) {
121 128 help = edit_shortcuts[i]['help'];
122 shortcut = shortcut_name(edit_shortcuts[i]['shortcut']);
129 shortcut = prettify(edit_shortcuts[i]['shortcut']);
123 130 edit_col1.append($('<div>').addClass('quickhelp').
124 131 append($('<span/>').addClass('shortcut_key').text(shortcut)).
125 132 append($('<span/>').addClass('shortcut_descr').text(' : ' + help))
@@ -127,7 +134,7 var IPython = (function (IPython) {
127 134 };
128 135 for (i=half; i<n; i++) {
129 136 help = edit_shortcuts[i]['help'];
130 shortcut = shortcut_name(edit_shortcuts[i]['shortcut']);
137 shortcut = prettify(edit_shortcuts[i]['shortcut']);
131 138 edit_col2.append($('<div>').addClass('quickhelp').
132 139 append($('<span/>').addClass('shortcut_key').text(shortcut)).
133 140 append($('<span/>').addClass('shortcut_descr').text(' : ' + help))
General Comments 0
You need to be logged in to leave comments. Login now