mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Eliminate Editor::onDidMoveCursor
If you want to know if a cursor moved, subscribe to the cursor.
This commit is contained in:
@@ -346,7 +346,7 @@ EditorComponent = React.createClass
|
||||
observeEditor: ->
|
||||
{editor} = @props
|
||||
@subscribe editor, 'screen-lines-changed', @onScreenLinesChanged
|
||||
@subscribe editor.onDidMoveCursor(@onCursorMoved)
|
||||
@subscribe editor.onDidAddCursor(@onCursorAdded)
|
||||
@subscribe editor, 'selection-removed selection-screen-range-changed', @onSelectionChanged
|
||||
@subscribe editor, 'selection-added', @onSelectionAdded
|
||||
@subscribe editor, 'decoration-added', @onDecorationChanged
|
||||
@@ -749,6 +749,10 @@ EditorComponent = React.createClass
|
||||
|
||||
onStoppedScrollingAfterDelay: null # created lazily
|
||||
|
||||
onCursorAdded: (cursor) ->
|
||||
@subscribe cursor, 'moved', @onCursorMoved
|
||||
@subscribe cursor, 'destroyed', => @unsubscribe(cursor)
|
||||
|
||||
onCursorMoved: ->
|
||||
@cursorMoved = true
|
||||
@requestUpdate()
|
||||
|
||||
@@ -318,9 +318,6 @@ class Editor extends Model
|
||||
onDidInsertText: (callback) ->
|
||||
@emitter.on 'did-insert-text', callback
|
||||
|
||||
onDidMoveCursor: (callback) ->
|
||||
@emitter.on 'did-move-cursor', callback
|
||||
|
||||
onDidAddCursor: (callback) ->
|
||||
@emitter.on 'did-add-cursor', callback
|
||||
|
||||
@@ -1863,7 +1860,6 @@ class Editor extends Model
|
||||
|
||||
cursorMoved: (cursor, event) ->
|
||||
@emit 'cursor-moved', event
|
||||
@emitter.emit 'did-move-cursor', _.extend({cursor}, event)
|
||||
|
||||
# Merge cursors that have the same screen position
|
||||
mergeCursors: ->
|
||||
|
||||
Reference in New Issue
Block a user