diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index d87952e85..bdb6b38fc 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -992,6 +992,13 @@ describe "TextEditor", -> editor.undo() expect(editor.getScrollTop()).toBe 0 + it "doesn't scroll when the cursor moves into the visible area", -> + editor.setCursorBufferPosition([0, 0]) + editor.setScrollTop(40) + expect(editor.getVisibleRowRange()).toEqual([4, 9]) + editor.setCursorBufferPosition([6, 0]) + expect(editor.getScrollTop()).toBe 40 + it "honors the autoscroll option on cursor and selection manipulation methods", -> expect(editor.getScrollTop()).toBe 0 editor.addCursorAtScreenPosition([11, 11], autoscroll: false) diff --git a/src/cursor.coffee b/src/cursor.coffee index c96f2eff5..de311358b 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -648,7 +648,7 @@ class Cursor extends Model ### changePosition: (options, fn) -> - @clearSelection(options) + @clearSelection(autoscroll: false) fn() @autoscroll() if options.autoscroll ? @isLastCursor()