From 07435e35e3860a9c93582d6eaa0c7b550d77d1d0 2012-02-01 18:26:07
From: Brian Granger <ellisonbg@gmail.com>
Date: 2012-02-01 18:26:07
Subject: [PATCH] Fixing #1337. Tooltip stops TAB from being handled by others.

Pressing TAB to get the tooltip "range(TAB" was inserting a TAB.
To get rid of this we are now telling CodeMirror to ignore it
and also stopping the event from bubbling up the DOM.

---

diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js
index 29e2e3f..8ee4c68 100644
--- a/IPython/frontend/html/notebook/static/js/codecell.js
+++ b/IPython/frontend/html/notebook/static/js/codecell.js
@@ -123,6 +123,10 @@ var IPython = (function (IPython) {
                 return false;
             } else if ((pre_cursor.substr(-1) === "("|| pre_cursor.substr(-1) === " ") && tooltip_on_tab ) {
                 that.request_tooltip_after_time(pre_cursor,0);
+                // Prevent the event from bubbling up.
+                event.stop();
+                // Prevent CodeMirror from handling the tab.
+                return true;
             } else {
                 pre_cursor.trim();
                 // Autocomplete the current line.