Rename Cursor and CursorView events to passive-voice scheme

Any events emitted from DOM nodes should be prefixed with an identifier
for the node that emits them. This eliminates the possibility of ambiguity
when the events bubble up the DOM away from their emitter.
This commit is contained in:
Nathan Sobo
2013-01-02 13:37:25 -07:00
parent 0f59f5f58a
commit f4f3002e6d
5 changed files with 8 additions and 8 deletions

View File

@@ -23,11 +23,11 @@ class CursorView extends View
@shouldPauseBlinking = true
@editor.requestDisplayUpdate()
@cursor.on 'change-visibility.cursor-view', (visible) =>
@cursor.on 'visibility-changed.cursor-view', (visible) =>
@needsUpdate = true
@editor.requestDisplayUpdate()
@cursor.on 'destroy.cursor-view', =>
@cursor.on 'destroyed.cursor-view', =>
@needsRemoval = true
@editor.requestDisplayUpdate()
@@ -43,7 +43,7 @@ class CursorView extends View
unless _.isEqual(@lastPixelPosition, pixelPosition)
changedPosition = true
@css(pixelPosition)
@trigger 'cursor-move'
@trigger 'cursor:moved'
if @shouldPauseBlinking
@resetBlinking()

View File

@@ -27,7 +27,7 @@ class Cursor
destroy: ->
@anchor.destroy()
@editSession.removeCursor(this)
@trigger 'destroy'
@trigger 'destroyed'
setScreenPosition: (screenPosition, options) ->
@goalColumn = null
@@ -52,7 +52,7 @@ class Cursor
if @visible != visible
@visible = visible
@needsAutoscroll = @visible and @isLastCursor()
@trigger 'change-visibility', @visible
@trigger 'visibility-changed', @visible
isVisible: -> @visible

View File

@@ -21,7 +21,7 @@ class Gutter extends View
editor = @editor()
highlightLines = => @highlightLines()
editor.on 'cursor-move', highlightLines
editor.on 'cursor:moved', highlightLines
editor.on 'selection-change', highlightLines
@on 'click', '.line-number', (e) =>
row = parseInt($(e.target).text()) - 1

View File

@@ -15,7 +15,7 @@ class Selection
@cursor.on 'moved.selection', ({bufferChange}) =>
@screenRangeChanged() unless bufferChange
@cursor.on 'destroy.selection', =>
@cursor.on 'destroyed.selection', =>
@cursor = null
@destroy()