diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 27c611faf..34c4bbf64 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -704,19 +704,18 @@ class Editor extends View prepareForScrolling: -> @adjustHeightOfRenderedLines() - @adjustWidthOfRenderedLines() + @adjustMinWidthOfRenderedLines() adjustHeightOfRenderedLines: -> heightOfRenderedLines = @lineHeight * @screenLineCount() @verticalScrollbarContent.height(heightOfRenderedLines) @renderedLines.css('padding-bottom', heightOfRenderedLines) - adjustWidthOfRenderedLines: -> - width = @charWidth * @maxScreenLineLength() - if width > @scrollView.width() - @renderedLines.width(width) - else - @renderedLines.css('width', '') + adjustMinWidthOfRenderedLines: -> + minWidth = @charWidth * @maxScreenLineLength() + unless @renderedLines.cachedMinWidth == minWidth + @renderedLines.css('min-width', minWidth) + @renderedLines.cachedMinWidth = minWidth handleScrollHeightChange: -> scrollHeight = @lineHeight * @screenLineCount() @@ -784,7 +783,7 @@ class Editor extends View if @attached @handleScrollHeightChange() unless newScreenRange.coversSameRows(oldScreenRange) - @adjustWidthOfRenderedLines() + @adjustMinWidthOfRenderedLines() return if oldScreenRange.start.row > @lastRenderedScreenRow diff --git a/static/editor.css b/static/editor.css index c05e57a29..6d4aac5f5 100644 --- a/static/editor.css +++ b/static/editor.css @@ -78,6 +78,8 @@ display: table; height: 100%; width: 100%; + overflow: hidden; + padding-right: 2em; } .editor .line span {