Fix double autoscroll when moving cursor

This commit is contained in:
Max Brunsfeld
2015-03-27 10:27:24 -07:00
parent 296a986b12
commit 230eb12a8a
2 changed files with 8 additions and 1 deletions

View File

@@ -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)

View File

@@ -648,7 +648,7 @@ class Cursor extends Model
###
changePosition: (options, fn) ->
@clearSelection(options)
@clearSelection(autoscroll: false)
fn()
@autoscroll() if options.autoscroll ? @isLastCursor()