' +
'
' +
'
' +
@@ -1133,12 +1134,13 @@ var CodeMirror = (function() {
}
function charX(line, pos) {
- var text = lines[line].text;
+ var text = lines[line].text, span = measure.firstChild;
if (text.lastIndexOf("\t", pos) == -1) return pos * charWidth();
+ var old = span.firstChild.nodeValue;
try {
- measure.firstChild.firstChild.nodeValue = text.slice(0, pos);
- return measure.firstChild.offsetWidth;
- } finally {measure.firstChild.firstChild.nodeValue = "-";}
+ span.firstChild.nodeValue = text.slice(0, pos);
+ return span.offsetWidth;
+ } finally {span.firstChild.nodeValue = old;}
}
function charFromX(line, x) {
var text = lines[line].text, cw = charWidth();
@@ -1169,7 +1171,7 @@ var CodeMirror = (function() {
if (nlines) return lineDiv.offsetHeight / nlines;
else return measure.offsetHeight || 1;
}
- function charWidth() {return measure.firstChild.offsetWidth || 1;}
+ function charWidth() {return (measure.firstChild.offsetWidth || 320) / 40;}
function paddingTop() {return lineWrap.offsetTop;}
function paddingLeft() {return lineWrap.offsetLeft;}