mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Pass old and new screen position with Anchor/Cursor move events
This commit is contained in:
@@ -54,7 +54,7 @@ class Anchor
|
||||
@screenPosition.row
|
||||
|
||||
setScreenPosition: (position, options={}) ->
|
||||
previousScreenPosition = @screenPosition
|
||||
oldScreenPosition = @screenPosition
|
||||
@screenPosition = Point.fromObject(position)
|
||||
clip = options.clip ? true
|
||||
assignBufferPosition = options.assignBufferPosition ? true
|
||||
@@ -65,8 +65,12 @@ class Anchor
|
||||
Object.freeze @screenPosition
|
||||
Object.freeze @bufferPosition
|
||||
|
||||
unless @screenPosition.isEqual(previousScreenPosition)
|
||||
@trigger 'moved', @screenPosition, bufferChange: options.bufferChange, autoscroll: options.autoscroll
|
||||
unless @screenPosition.isEqual(oldScreenPosition)
|
||||
@trigger 'moved',
|
||||
oldScreenPosition: oldScreenPosition
|
||||
newScreenPosition: @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 'moved.cursor-view', (screenPosition, { autoscroll }) =>
|
||||
@cursor.on 'moved.cursor-view', ({ autoscroll }) =>
|
||||
@needsUpdate = true
|
||||
@shouldPauseBlinking = true
|
||||
@needsAutoscroll = (autoscroll ? true) and @cursor?.isLastCursor()
|
||||
|
||||
@@ -12,8 +12,8 @@ class Selection
|
||||
constructor: ({@cursor, @editSession}) ->
|
||||
@cursor.selection = this
|
||||
|
||||
@cursor.on 'moved.selection', (e) =>
|
||||
@screenRangeChanged() unless e.bufferChange
|
||||
@cursor.on 'moved.selection', ({bufferChange}) =>
|
||||
@screenRangeChanged() unless bufferChange
|
||||
|
||||
@cursor.on 'destroy.selection', =>
|
||||
@cursor = null
|
||||
|
||||
Reference in New Issue
Block a user