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<tab>

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]`.
This commit is contained in:
Matthias BUSSONNIER 2013-07-10 10:57:49 +02:00
parent f0db998d4d
commit 1e75582e48

View File

@ -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;
}