mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Multi-cursor scrolling is based on the last created cursor
This commit is contained in:
@@ -677,8 +677,8 @@ describe "Editor", ->
|
||||
setEditorWidthInChars(editor, 20)
|
||||
setEditorHeightInChars(editor, 10)
|
||||
editor.setCursorBufferPosition([11,0])
|
||||
editor.addCursorAtBufferPosition([0,0])
|
||||
editor.addCursorAtBufferPosition([6,50])
|
||||
editor.addCursorAtBufferPosition([0,0])
|
||||
window.advanceClock()
|
||||
|
||||
scrollHandler = spyOn(editor, 'scrollVertically')
|
||||
@@ -701,7 +701,7 @@ describe "Editor", ->
|
||||
editor.moveCursorRight()
|
||||
window.advanceClock()
|
||||
|
||||
position = editor.pixelPositionForScreenPosition([0,1])
|
||||
position = editor.pixelPositionForScreenPosition([6,1])
|
||||
expect(scrollHandler).toHaveBeenCalledWith(position)
|
||||
|
||||
describe "auto indent/outdent", ->
|
||||
|
||||
@@ -136,5 +136,5 @@ class Cursor extends View
|
||||
position = @editor.pixelPositionForScreenPosition(screenPosition)
|
||||
@css(position)
|
||||
|
||||
if @editor.getCursors().length == 1 or @editor.screenPositionInBounds(screenPosition)
|
||||
if this == _.last(@editor.getCursors())
|
||||
@editor.scrollTo(position)
|
||||
|
||||
@@ -37,7 +37,6 @@ class Editor extends View
|
||||
autoIndent: null
|
||||
lineCache: null
|
||||
isFocused: false
|
||||
isScrolling: false
|
||||
|
||||
initialize: ({buffer}) ->
|
||||
requireStylesheet 'editor.css'
|
||||
@@ -481,10 +480,7 @@ class Editor extends View
|
||||
@buffer.getMode()
|
||||
|
||||
scrollTo: (position) ->
|
||||
return if @isScrolling
|
||||
@isScrolling = true
|
||||
_.defer =>
|
||||
@isScrolling = false
|
||||
@scrollVertically(position)
|
||||
@scrollHorizontally(position)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user