Merge pull request #1716 from ether/only-redraw-existing-lines

only try to redraw the line height of lines that exist..
This commit is contained in:
John McLear 2013-04-08 08:44:48 -07:00
commit 12bc98af7e
1 changed files with 12 additions and 7 deletions

View File

@ -5180,7 +5180,6 @@ function Ace2Inner(){
{ {
if(n > lineNumbersShown) //all updated, break if(n > lineNumbersShown) //all updated, break
break; break;
var h = (b.clientHeight || b.offsetHeight); var h = (b.clientHeight || b.offsetHeight);
if (b.nextSibling) if (b.nextSibling)
{ {
@ -5215,17 +5214,23 @@ function Ace2Inner(){
var n = lineNumbersShown; var n = lineNumbersShown;
var div = odoc.createElement("DIV"); var div = odoc.createElement("DIV");
//calculate height for new line number //calculate height for new line number
var h = (b.clientHeight || b.offsetHeight); if(b){
var h = (b.clientHeight || b.offsetHeight);
if (b.nextSibling) if (b.nextSibling){
h = b.nextSibling.offsetTop - b.offsetTop; h = b.nextSibling.offsetTop - b.offsetTop;
}
}
if(h) // apply style to div if(h){ // apply style to div
div.style.height = h +"px"; div.style.height = h +"px";
}
div.appendChild(odoc.createTextNode(String(n))); div.appendChild(odoc.createTextNode(String(n)));
fragment.appendChild(div); fragment.appendChild(div);
b = b.nextSibling; if(b){
b = b.nextSibling;
}
} }
container.appendChild(fragment); container.appendChild(fragment);