diff --git a/IPython/frontend/html/notebook/static/base/js/utils.js b/IPython/frontend/html/notebook/static/base/js/utils.js
index d4490f2..a9be239 100644
--- a/IPython/frontend/html/notebook/static/base/js/utils.js
+++ b/IPython/frontend/html/notebook/static/base/js/utils.js
@@ -225,8 +225,8 @@ IPython.utils = (function (IPython) {
"$1$2$3");
}
- // some keycodes that seem to be platform/browser independant
- var keycodes ={
+ // some keycodes that seem to be platform/browser independent
+ var keycodes = {
BACKSPACE: 8,
TAB : 9,
ENTER : 13,
@@ -253,7 +253,36 @@ IPython.utils = (function (IPython) {
DOWN_ARROW: 40,
DOWNARROW: 40,
DOWN : 40,
- COMMAND : 91,
+ LEFT_SUPER : 91,
+ RIGHT_SUPER : 92,
+ COMMAND : 93,
+ };
+
+
+ var is_typing = function (event) {
+ // return whether a key event is probably typing (used for setting the dirty flag)
+ var key = event.which;
+ if ( key < 46 ) {
+ if (
+ ( key == keycodes.BACKSPACE ) ||
+ ( key == keycodes.TAB ) ||
+ ( key == keycodes.ENTER )
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ if (
+ ( key == keycodes.LEFT_SUPER ) ||
+ ( key == keycodes.RIGHT_SUPER ) ||
+ ( key == keycodes.COMMAND )
+ ) {
+ return false;
+ } else {
+ return true;
+ }
+ }
};
@@ -283,6 +312,7 @@ IPython.utils = (function (IPython) {
keycodes : keycodes,
fixCarriageReturn : fixCarriageReturn,
autoLinkUrls : autoLinkUrls,
+ is_typing : is_typing,
points_to_pixels : points_to_pixels,
browser : browser
};