Rename 'change-screen-position' event to 'moved' on Anchor and Cursor

This commit is contained in:
Nathan Sobo
2012-11-29 12:09:23 -07:00
parent 69485724cd
commit 91e899456a
4 changed files with 5 additions and 5 deletions

View File

@@ -66,7 +66,7 @@ class Anchor
Object.freeze @bufferPosition
unless @screenPosition.isEqual(previousScreenPosition)
@trigger 'change-screen-position', @screenPosition, bufferChange: options.bufferChange, autoscroll: options.autoscroll
@trigger 'moved', @screenPosition, bufferChange: options.bufferChange, autoscroll: options.autoscroll
refreshScreenPosition: (options={}) ->
return unless @editSession

View File

@@ -19,7 +19,7 @@ class CursorView extends View
shouldPauseBlinking: false
initialize: (@cursor, @editor) ->
@cursor.on 'change-screen-position.cursor-view', (screenPosition, { autoscroll }) =>
@cursor.on 'moved.cursor-view', (screenPosition, { autoscroll }) =>
@needsUpdate = true
@shouldPauseBlinking = true
@needsAutoscroll = (autoscroll ? true) and @cursor?.isLastCursor()

View File

@@ -14,7 +14,7 @@ class Cursor
constructor: ({@editSession, screenPosition, bufferPosition}) ->
@anchor = @editSession.addAnchor(strong: true)
@anchor.on 'change-screen-position', (args...) => @trigger 'change-screen-position', args...
@anchor.on 'moved', (args...) => @trigger 'moved', args...
@setScreenPosition(screenPosition) if screenPosition
@setBufferPosition(bufferPosition) if bufferPosition

View File

@@ -12,7 +12,7 @@ class Selection
constructor: ({@cursor, @editSession}) ->
@cursor.selection = this
@cursor.on 'change-screen-position.selection', (e) =>
@cursor.on 'moved.selection', (e) =>
@screenRangeChanged() unless e.bufferChange
@cursor.on 'destroy.selection', =>
@@ -342,7 +342,7 @@ class Selection
placeAnchor: ->
@anchor = @editSession.addAnchor(strong: true)
@anchor.setScreenPosition(@cursor.getScreenPosition())
@anchor.on 'change-screen-position.selection', => @screenRangeChanged()
@anchor.on 'moved.selection', => @screenRangeChanged()
intersectsBufferRange: (bufferRange) ->
@getBufferRange().intersectsWith(bufferRange)