fixed indention + variable scoping

This commit is contained in:
Matthias Bartelmeß 2012-02-21 21:46:25 +01:00
parent 10cbb485fb
commit eae87fd835
1 changed files with 24 additions and 18 deletions

View File

@ -5828,16 +5828,19 @@ function OUTER(gscope)
{ {
var newNumLines = rep.lines.length(); var newNumLines = rep.lines.length();
if (newNumLines < 1) newNumLines = 1; if (newNumLines < 1) newNumLines = 1;
//update height of all current line numbers //update height of all current line numbers
var a = sideDivInner.firstChild;
var b = doc.body.firstChild;
var n = 0;
if (currentCallStack && currentCallStack.domClean) if (currentCallStack && currentCallStack.domClean)
{ {
var a = sideDivInner.firstChild;
var b = doc.body.firstChild;
var n = 0;
while (a && b) while (a && b)
{ {
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)
@ -5853,12 +5856,12 @@ function OUTER(gscope)
{ {
var hpx = h + "px"; var hpx = h + "px";
if (a.style.height != hpx) { if (a.style.height != hpx) {
a.style.height = hpx; a.style.height = hpx;
} }
} }
a = a.nextSibling; a = a.nextSibling;
b = b.nextSibling; b = b.nextSibling;
n++; n++;
} }
} }
@ -5872,17 +5875,20 @@ function OUTER(gscope)
lineNumbersShown++; lineNumbersShown++;
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); var h = (b.clientHeight || b.offsetHeight);
if (b.nextSibling)
h = b.nextSibling.offsetTop - b.offsetTop; if (b.nextSibling)
if(h) // apply style to div h = b.nextSibling.offsetTop - b.offsetTop;
div.style.height = h +"px";
if(h) // apply style to div
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; b = b.nextSibling;
} }
container.appendChild(fragment); container.appendChild(fragment);
while (lineNumbersShown > newNumLines) while (lineNumbersShown > newNumLines)
{ {
@ -5891,8 +5897,8 @@ function OUTER(gscope)
} }
} }
} }
}
};
OUTER(this); OUTER(this);