mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Rename 'change-screen-position' event to 'moved' on Anchor and Cursor
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user