From b689ffd402aef055da988cf054691302879ac38a Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 28 Jun 2014 15:26:02 +0100 Subject: [PATCH] Autoscroll cursor when attempting to move it, even if it doesn't move --- src/cursor.coffee | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cursor.coffee b/src/cursor.coffee index 08e8f7e94..7ab62ae81 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -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())