Merge pull request #2763 from atom/ns-react-fix-autoscroll

Autoscroll cursor when attempting to move it, even if it doesn't move
This commit is contained in:
Nathan Sobo
2014-06-28 15:42:31 +01:00

View File

@@ -29,9 +29,6 @@ class Cursor extends Model
# Supports old editor view
@needsAutoscroll ?= @isLastCursor() and !textChanged
# Supports react editor view
@autoscroll() if @needsAutoscroll and @editor.manageScrollPosition
@goalColumn = null
movedEvent =
@@ -55,8 +52,10 @@ class Cursor extends Model
changePosition: (options, fn) ->
@clearSelection()
@needsAutoscroll = options.autoscroll ? @isLastCursor()
unless fn()
@emit 'autoscrolled' if @needsAutoscroll
fn()
if @needsAutoscroll
@emit 'autoscrolled' # Support legacy editor
@autoscroll() if @needsAutoscroll and @editor.manageScrollPosition # Support react editor view
getPixelRect: ->
@editor.pixelRectForScreenRange(@getScreenRange())