mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Merge pull request #8436 from atom/as-batch-cursor-updates
Batch cursor updates
This commit is contained in:
@@ -410,10 +410,7 @@ class TextEditorPresenter
|
||||
@updateCursorState(cursor) for cursor in @model.cursors # using property directly to avoid allocation
|
||||
return
|
||||
|
||||
updateCursorState: (cursor, destroyOnly = false) ->
|
||||
delete @state.content.cursors[cursor.id]
|
||||
|
||||
return if destroyOnly
|
||||
updateCursorState: (cursor) ->
|
||||
return unless @startRow? and @endRow? and @hasPixelRectRequirements() and @baseCharacterWidth?
|
||||
return unless cursor.isVisible() and @startRow <= cursor.getScreenRow() < @endRow
|
||||
|
||||
@@ -421,8 +418,6 @@ class TextEditorPresenter
|
||||
pixelRect.width = @baseCharacterWidth if pixelRect.width is 0
|
||||
@state.content.cursors[cursor.id] = pixelRect
|
||||
|
||||
@emitDidUpdateState()
|
||||
|
||||
updateOverlaysState: ->
|
||||
return unless @hasOverlayPositionRequirements()
|
||||
|
||||
@@ -1365,20 +1360,22 @@ class TextEditorPresenter
|
||||
observeCursor: (cursor) ->
|
||||
didChangePositionDisposable = cursor.onDidChangePosition =>
|
||||
@shouldUpdateHiddenInputState = true if cursor.isLastCursor()
|
||||
@shouldUpdateCursorsState = true
|
||||
@pauseCursorBlinking()
|
||||
@updateCursorState(cursor)
|
||||
|
||||
@emitDidUpdateState()
|
||||
|
||||
didChangeVisibilityDisposable = cursor.onDidChangeVisibility =>
|
||||
@updateCursorState(cursor)
|
||||
@shouldUpdateCursorsState = true
|
||||
|
||||
@emitDidUpdateState()
|
||||
|
||||
didDestroyDisposable = cursor.onDidDestroy =>
|
||||
@disposables.remove(didChangePositionDisposable)
|
||||
@disposables.remove(didChangeVisibilityDisposable)
|
||||
@disposables.remove(didDestroyDisposable)
|
||||
@shouldUpdateHiddenInputState = true
|
||||
@updateCursorState(cursor, true)
|
||||
@shouldUpdateCursorsState = true
|
||||
|
||||
@emitDidUpdateState()
|
||||
|
||||
@@ -1389,8 +1386,9 @@ class TextEditorPresenter
|
||||
didAddCursor: (cursor) ->
|
||||
@observeCursor(cursor)
|
||||
@shouldUpdateHiddenInputState = true
|
||||
@shouldUpdateCursorsState = true
|
||||
@pauseCursorBlinking()
|
||||
@updateCursorState(cursor)
|
||||
|
||||
@emitDidUpdateState()
|
||||
|
||||
startBlinkingCursors: ->
|
||||
|
||||
Reference in New Issue
Block a user