Eliminate Editor::onDidMoveCursor

If you want to know if a cursor moved, subscribe to the cursor.
This commit is contained in:
Nathan Sobo
2014-09-04 09:52:14 -06:00
committed by Ben Ogle
parent e77b4a54dd
commit 3e77b9b7c0
2 changed files with 5 additions and 5 deletions

View File

@@ -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()

View File

@@ -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: ->