Update selection rendering when font size changes

This commit is contained in:
Nathan Sobo
2012-11-07 14:22:43 -07:00
parent df392359f9
commit 144cfadb15
2 changed files with 17 additions and 0 deletions

View File

@@ -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()

View File

@@ -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()