Skip to content

Commit

Permalink
Properly measure the width of a line when a range widget is at its end
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Feb 1, 2013
1 parent 0bebb4f commit 8f63800
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,9 @@ window.CodeMirror = (function() {
var vr = cur.top;
cur.top = vranges[vr]; cur.bottom = vranges[vr+1];
}
if (!cm.options.lineWrapping)
data.width = pre.lastChild.getBoundingClientRect().right - outer.left;

return data;
}

Expand Down Expand Up @@ -1221,7 +1224,7 @@ window.CodeMirror = (function() {
var display = cm.display;
if (op.updateMaxLine) computeMaxLength(cm);
if (cm.display.maxLineChanged && !cm.options.lineWrapping) {
var width = measureChar(cm, cm.display.maxLine, cm.display.maxLine.text.length).right;
var width = measureLine(cm, cm.display.maxLine).width;
display.sizer.style.minWidth = Math.max(0, width + 3 + scrollerCutOff) + "px";
cm.display.maxLineChanged = false;
var maxScrollLeft = Math.max(0, display.sizer.offsetLeft + display.sizer.offsetWidth - display.scroller.clientWidth);
Expand Down

0 comments on commit 8f63800

Please sign in to comment.