Skip to content

Commit

Permalink
Selection views update properly when selections are merged
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Sobo committed Jun 14, 2012
1 parent 47533ad commit 470f469
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion spec/app/editor-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/app/selection-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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: ->
Expand Down

0 comments on commit 470f469

Please sign in to comment.