From b1449981dc525536e0cbe552fa13a328f1afcf8d 2012-05-31 20:08:14 From: Matthias BUSSONNIER Date: 2012-05-31 20:08:14 Subject: [PATCH] fix replace range bug pylab.l would be replace by .l because of a bug in common start finding .l on the fifth position of pylab.start. --- diff --git a/IPython/frontend/html/notebook/static/js/completer.js b/IPython/frontend/html/notebook/static/js/completer.js index ccc661c..82ea8f0 100644 --- a/IPython/frontend/html/notebook/static/js/completer.js +++ b/IPython/frontend/html/notebook/static/js/completer.js @@ -47,7 +47,7 @@ var IPython = (function(IPython ) { while(s && tem2.indexOf(tem1) == -1){ tem1 = tem1.substring(0, --s); } - if (tem1 == "" ){return null;} + if (tem1 == "" || tem2.indexOf(tem1) != 0){return null;} return { str : tem1, type : "computed", from : B[0].from, @@ -210,7 +210,7 @@ var IPython = (function(IPython ) { //Check that shared start is not null which can append with prefixed completion // like %pylab , pylab have no shred start, and ff will result in py // to erase py - var sh = sharedStart(this.raw_result) + var sh = sharedStart(this.raw_result); if(sh){ this.insert(sh); }