Selection views update properly when selections are merged

This commit is contained in:
Nathan Sobo
2012-06-14 10:28:21 -06:00
parent 47533ad3a0
commit 470f46931f
2 changed files with 13 additions and 2 deletions

View File

@@ -768,8 +768,19 @@ describe "Editor", ->
expect(selectionView.regions.length).toBe 3
expect(selectionView.find('.selection').length).toBe 3
describe "when a selection merges with another selection", ->
it "removes the merged selection view", ->
editSession = editor.activeEditSession
editSession.setCursorScreenPosition([4, 10])
editSession.selectToScreenPosition([5, 27])
editSession.addCursorAtScreenPosition([3, 10])
editSession.selectToScreenPosition([6, 27])
expect(editor.getSelectionViews().length).toBe 1
expect(editor.find('.selection').length).toBe 3
describe "cursor rendering", ->
describe "when the cursor moves", ->
charWidth = null

View File

@@ -13,7 +13,7 @@ class SelectionView extends View
initialize: ({@editor, @selection} = {}) ->
@regions = []
@selection.on 'change-screen-range', => @updateAppearance()
@selection.on 'destroy', => @remove('ignore')
@selection.on 'destroy', => @remove()
@updateAppearance()
updateAppearance: ->