Skip to content

Commit

Permalink
Fix problem where horiz scrollbar stayed after long lines were deleted
Browse files Browse the repository at this point in the history
Closes #138
  • Loading branch information
marijnh committed Jul 5, 2011
1 parent 2761c80 commit d433e70
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/codemirror.js
Expand Up @@ -765,9 +765,13 @@ var CodeMirror = (function() {
}

var textWidth = stringWidth(maxLine);
lineSpace.style.width = textWidth > scroller.clientWidth ? textWidth + "px" : "";
// Needed to prevent odd wrapping/hiding of widgets placed in here.
code.style.width = scroller.scrollWidth + "px";
if (textWidth > scroller.clientWidth) {
lineSpace.style.width = textWidth + "px";
// Needed to prevent odd wrapping/hiding of widgets placed in here.
code.style.width = scroller.scrollWidth + "px";
} else {
lineSpace.style.width = code.style.width = "";
}

// Since this is all rather error prone, it is honoured with the
// only assertion in the whole file.
Expand Down

0 comments on commit d433e70

Please sign in to comment.