diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 73d20676b..8ec68db22 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -501,6 +501,18 @@ describe "Editor", -> rootView.setFontSize(22) expect(editor.css('font-size')).toBe '30px' + it "updates the position and size of selection regions", -> + rootView.attachToDom() + rootView.setFontSize(10) + editor.setSelectedBufferRange([[5, 2], [5, 7]]) + + rootView.setFontSize(30) + selectionRegion = editor.find('.selection') + expect(selectionRegion.position().top).toBe 5 * editor.lineHeight + expect(selectionRegion.position().left).toBe 2 * editor.charWidth + expect(selectionRegion.height()).toBe editor.lineHeight + expect(selectionRegion.width()).toBe 5 * editor.charWidth + it "updates the gutter width and font size", -> rootView.attachToDom() originalFontSize = rootView.getFontSize() diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 2d88288f1..a238921bd 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -575,6 +575,7 @@ class Editor extends View @updatePaddingOfRenderedLines() @handleScrollHeightChange() @updateCursorViews() + @updateSelectionViews() @updateRenderedLines() newSplitEditor: -> @@ -668,6 +669,10 @@ class Editor extends View for cursorView in @getCursorViews() cursorView.updateAppearance() + updateSelectionViews: -> + for selectionView in @getSelectionViews() + selectionView.updateAppearance() + syncCursorAnimations: -> for cursorView in @getCursorViews() do (cursorView) -> cursorView.resetCursorAnimation()