mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Fix double autoscroll when moving cursor
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -648,7 +648,7 @@ class Cursor extends Model
|
||||
###
|
||||
|
||||
changePosition: (options, fn) ->
|
||||
@clearSelection(options)
|
||||
@clearSelection(autoscroll: false)
|
||||
fn()
|
||||
@autoscroll() if options.autoscroll ? @isLastCursor()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user