diff --git a/package.json b/package.json index 7e591c967..a893b07a8 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "tree-view": "0.28.0", "visual-bell": "0.3.0", "whitespace": "0.8.0", - "wrap-guide": "0.4.0", + "wrap-guide": "0.5.0", "language-c": "0.2.0", "language-clojure": "0.1.0", diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 5147a8ec8..35e2f3dd8 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -777,6 +777,9 @@ describe "Editor", -> # resizes with the editor expect(editor.width()).toBeLessThan(800) editor.width(800) + editor.resize() # call to trigger the resize event. + + region2 = selectionView.regions[1] expect(region2.width()).toBe(editor.renderedLines.outerWidth()) region3 = selectionView.regions[2] diff --git a/src/editor.coffee b/src/editor.coffee index 441fae9d6..296433b18 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -773,6 +773,7 @@ class Editor extends View @subscribe $(window), "resize.editor-#{@id}", => @setHeightInLines() @setWidthInChars() + @updateLayerDimensions() @requestDisplayUpdate() @focus() if @isFocused @@ -1156,7 +1157,7 @@ class Editor extends View @verticalScrollbarContent.height(@layerHeight) @scrollBottom(height) if @scrollBottom() > height - minWidth = @charWidth * @getMaxScreenLineLength() + 20 + minWidth = Math.max(@charWidth * @getMaxScreenLineLength() + 20, @scrollView.width()) unless @layerMinWidth == minWidth @renderedLines.css('min-width', minWidth) @underlayer.css('min-width', minWidth) @@ -1597,6 +1598,9 @@ class Editor extends View returnLeft = null + offsetLeft = @scrollView.offset().left + paddingLeft = parseInt(@scrollView.css('padding-left')) + while textNode = iterator.nextNode() content = textNode.textContent @@ -1619,7 +1623,7 @@ class Editor extends View MeasureRange.collapse() rects = MeasureRange.getClientRects() return 0 if rects.length == 0 - left = rects[0].left - Math.floor(@scrollView.offset().left) + Math.floor(@scrollLeft()) + left = rects[0].left - Math.floor(offsetLeft) + Math.floor(@scrollLeft()) - paddingLeft if scopes? cachedCharWidth = left - oldLeft diff --git a/static/editor.less b/static/editor.less index 912f9503d..c4b762ace 100644 --- a/static/editor.less +++ b/static/editor.less @@ -101,12 +101,6 @@ overflow-x: hidden; } -.editor .underlayer, -.editor .lines, -.editor .overlayer { - width: 100%; -} - .editor .underlayer { z-index: 0; position: absolute;