diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index 708ed73..1db7268 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -540,6 +540,7 @@ var IPython = (function (IPython) { var ShortcutManager = function (delay) { this._shortcuts = {} this._counts = {} + this._timers = {} this.delay = delay || 800; // delay in milliseconds } @@ -633,17 +634,21 @@ var IPython = (function (IPython) { ShortcutManager.prototype.count_handler = function (shortcut, event, data) { var that = this; var c = this._counts; + var t = this._timers; + var timer = null; if (c[shortcut] === data.count-1) { c[shortcut] = 0; + var timer = t[shortcut]; + if (timer) {clearTimeout(timer);} return data.handler(event); } else { c[shortcut] = c[shortcut] + 1; - setTimeout(function () { + timer = setTimeout(function () { c[shortcut] = 0; }, that.delay); + t[shortcut] = timer; } return false; - } ShortcutManager.prototype.call_handler = function (event) {