From dc6355ffb7e6f0fdebc9d05873928673935a1598 Mon Sep 17 00:00:00 2001
From: Jonathan Frederic <jdfreder@calpoly.edu>
Date: Thu, 20 Mar 2014 15:57:26 -0700
Subject: [PATCH] Prevent tab key from bubbling when the completer is open

---
 IPython/html/static/notebook/js/completer.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/IPython/html/static/notebook/js/completer.js b/IPython/html/static/notebook/js/completer.js
index b33713ff8..2e454fe45 100644
--- a/IPython/html/static/notebook/js/completer.js
+++ b/IPython/html/static/notebook/js/completer.js
@@ -250,7 +250,16 @@ var IPython = (function (IPython) {
         });
         this.sel.blur($.proxy(this.close, this));
         this.sel.keydown(function (event) {
-            that.keydown(event);
+            // Ignore tab key since it causes the completer to reshow on some 
+            // machines and not with others.  This strange behavior is due to
+            // the fact that we are tricking the notebook into thinking that it
+            // is in edit mode when it's really not.
+            if (IPython.keyboard.event_to_shortcut(event)=='tab') {
+                event.stopPropagation();
+                event.preventDefault();
+            } else {
+                that.keydown(event);
+            }
         });
         this.sel.keypress(function (event) {
             that.keypress(event);