From 1e75582e48ba1393ec159e9b73937165546c2973 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Wed, 10 Jul 2013 10:57:49 +0200 Subject: [PATCH] Fix duplicate completion in notebook comparaison between kernel completion and context-completin were returning duplicate entry in some cases, due to trailing space. sripping trailing space in comparaison prevent this. fixes #3563 example import bar from foo im used to propose `import` twice (actually `import` and `import[space]` as$ `import` was a token on the first line) now just complete directly to$ `import[space]`. --- IPython/html/static/notebook/js/completer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IPython/html/static/notebook/js/completer.js b/IPython/html/static/notebook/js/completer.js index e59220688..5386a4a7e 100644 --- a/IPython/html/static/notebook/js/completer.js +++ b/IPython/html/static/notebook/js/completer.js @@ -15,10 +15,10 @@ var IPython = (function (IPython) { } function _existing_completion(item, completion_array){ - for( var c in completion_array ) { - if(completion_array[c].substr(-item.length) == item) - { return true; } - } + for( var c in completion_array ) { + if(completion_array[c].trim().substr(-item.length) == item) + { return true; } + } return false; }