diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 264ff9b11..6749e7803 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -246,8 +246,10 @@ describe "TextEditorComponent", -> # lines caused full-screen repaints after switching away from an editor # and back again Please ensure you don't cause a performance regression if # you change this behavior. + editorFullWidth = editor.getScrollWidth() + editor.getVerticalScrollbarWidth() + for lineNode in lineNodes - expect(lineNode.style.width).toBe editor.getScrollWidth() + 'px' + expect(lineNode.style.width).toBe editorFullWidth + 'px' componentNode.style.width = gutterWidth + editor.getScrollWidth() + 100 + 'px' component.measureDimensions() diff --git a/src/lines-component.coffee b/src/lines-component.coffee index bac1c9616..f8b6579a5 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -54,14 +54,14 @@ class LinesComponent @removeTileNodes() unless @oldState.indentGuidesVisible is @newState.indentGuidesVisible @updateTileNodes() - if @newState.scrollWidth isnt @oldState.scrollWidth - @domNode.style.width = @newState.scrollWidth + 'px' - @oldState.scrollWidth = @newState.scrollWidth + if @newState.width isnt @oldState.width + @domNode.style.width = @newState.width + 'px' @cursorsComponent.updateSync(state) @oldState.indentGuidesVisible = @newState.indentGuidesVisible @oldState.scrollWidth = @newState.scrollWidth + @oldState.width = @newState.width removeTileNodes: -> @removeTileNode(id) for id of @oldState.tiles diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 3149faf56..0e7e448fa 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -307,6 +307,7 @@ class TextEditorPresenter @state.hiddenInput.width = Math.max(width, 2) updateContentState: -> + @state.content.width = Math.max(@contentWidth + @verticalScrollbarWidth, @contentFrameWidth) @state.content.scrollWidth = @scrollWidth @state.content.scrollLeft = @scrollLeft @state.content.indentGuidesVisible = not @model.isMini() and @showIndentGuide diff --git a/src/tile-component.coffee b/src/tile-component.coffee index 9ceca8e54..99dfc6ced 100644 --- a/src/tile-component.coffee +++ b/src/tile-component.coffee @@ -52,6 +52,9 @@ class TileComponent @domNode.style.height = @newTileState.height + 'px' @oldTileState.height = @newTileState.height + if @newState.width isnt @oldState.width + @domNode.style.width = @newState.width + 'px' + if @newTileState.top isnt @oldTileState.top or @newTileState.left isnt @oldTileState.left @domNode.style['-webkit-transform'] = "translate3d(#{@newTileState.left}px, #{@newTileState.top}px, 0px)" @oldTileState.top = @newTileState.top @@ -60,14 +63,9 @@ class TileComponent @removeLineNodes() unless @oldState.indentGuidesVisible is @newState.indentGuidesVisible @updateLineNodes() - if @newState.scrollWidth isnt @oldState.scrollWidth - @domNode.style.width = @newState.scrollWidth + 'px' - @oldState.scrollWidth = @newState.scrollWidth - @highlightsComponent.updateSync(@newTileState) @oldState.indentGuidesVisible = @newState.indentGuidesVisible - @oldState.scrollWidth = @newState.scrollWidth removeLineNodes: -> @removeLineNode(id) for id of @oldTileState.lines @@ -112,7 +110,7 @@ class TileComponent return buildLineHTML: (id) -> - {scrollWidth} = @newState + {width} = @newState {screenRow, tokens, text, top, lineEnding, fold, isSoftWrapped, indentLevel, decorationClasses} = @newTileState.lines[id] classes = '' @@ -121,7 +119,7 @@ class TileComponent classes += decorationClass + ' ' classes += 'line' - lineHTML = "