Cursor *model* clears selection when cursor moves, not the view.

This commit is contained in:
Nathan Sobo
2012-06-08 18:49:18 -06:00
parent 2161336c78
commit b0d1dd217b
2 changed files with 6 additions and 5 deletions

View File

@@ -17,7 +17,6 @@ class CursorView extends View
@cursor.on 'change-screen-position', (position, options) =>
@updateAppearance()
unless options.bufferChange
@clearSelection()
@removeIdleClassTemporarily()
@trigger 'cursor-move', bufferChange: options.bufferChange
@@ -74,7 +73,3 @@ class CursorView extends View
window.clearTimeout(@idleTimeout) if @idleTimeout
@removeClass 'idle'
_.defer => @addClass 'idle'
clearSelection: ->
if selectionView = @getSelectionView()
selectionView.clearSelection() unless selectionView.retainSelection

View File

@@ -23,6 +23,7 @@ class Cursor
setScreenPosition: (screenPosition, options) ->
@anchor.setScreenPosition(screenPosition, options)
@goalColumn = null
@clearSelection()
@trigger 'change-screen-position', @getScreenPosition(), bufferChange: false
getScreenPosition: ->
@@ -31,11 +32,16 @@ class Cursor
setBufferPosition: (bufferPosition, options) ->
@anchor.setBufferPosition(bufferPosition, options)
@goalColumn = null
@clearSelection()
@trigger 'change-screen-position', @getScreenPosition(), bufferChange: false
getBufferPosition: ->
@anchor.getBufferPosition()
clearSelection: ->
if @selection
@selection.clear() unless @selection.retainSelection
getCurrentScreenRow: ->
@getScreenPosition().row