diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 140c80088..6651fb6c1 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -1241,6 +1241,7 @@ describe "Editor", -> expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(6) it "increases the width of the rendered lines element to be either the width of the longest line or the width of the scrollView (whichever is longer)", -> + setEditorWidthInChars(editor, editor.maxScreenLineLength()) widthBefore = editor.renderedLines.width() expect(widthBefore).toBe editor.scrollView.width() buffer.change([[12,0], [12,0]], [1..50].join('')) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 62c51b39d..eb82d2c3b 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -142,6 +142,7 @@ window.tokensText = (tokens) -> window.setEditorWidthInChars = (editor, widthInChars, charWidth=editor.charWidth) -> editor.width(charWidth * widthInChars + editor.renderedLines.position().left) + $(window).trigger 'resize' # update width of editor's on-screen lines window.setEditorHeightInLines = (editor, heightInChars, charHeight=editor.lineHeight) -> editor.height(charHeight * heightInChars + editor.renderedLines.position().top) diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 7fe8edba2..9a31078da 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -337,7 +337,9 @@ class Editor extends View @calculateDimensions() @hiddenInput.width(@charWidth) @setSoftWrapColumn() if @activeEditSession.getSoftWrap() - $(window).on "resize.editor#{@id}", => @updateRenderedLines() + $(window).on "resize.editor#{@id}", => + @updateRenderedLines() + @adjustWidthOfRenderedLines() # TODO: This should happen automatically with CSS @focus() if @isFocused @renderWhenAttached()