mirror of
https://github.com/atom/atom.git
synced 2026-02-09 14:15:24 -05:00
Only one visible cursor causes the editor to scroll
This commit is contained in:
@@ -132,11 +132,21 @@ class Cursor extends View
|
||||
@setBufferPosition @editor.getEofPosition()
|
||||
|
||||
updateAppearance: ->
|
||||
position = @editor.pixelPositionForScreenPosition(@getScreenPosition())
|
||||
screenPosition = @getScreenPosition()
|
||||
position = @editor.pixelPositionForScreenPosition(screenPosition)
|
||||
@css(position)
|
||||
|
||||
if @editor.getCursors().length == 1 or @editor.screenPositionInBounds(screenPosition)
|
||||
@autoScroll(position)
|
||||
|
||||
autoScroll: (position) ->
|
||||
return if @editor._autoScrolling
|
||||
|
||||
@editor._autoScrolling = true
|
||||
_.defer =>
|
||||
@autoScrollVertically(position)
|
||||
@autoScrollHorizontally(position)
|
||||
@editor._autoScrolling = false
|
||||
@autoScrollVertically(position)
|
||||
@autoScrollHorizontally(position)
|
||||
|
||||
autoScrollVertically: (position) ->
|
||||
linesInView = @editor.scroller.height() / @editor.lineHeight
|
||||
|
||||
@@ -163,10 +163,10 @@ class Editor extends View
|
||||
@parents('#root-view').view()
|
||||
|
||||
bounds: ->
|
||||
rows = @height() / @lineHeight
|
||||
columns = @horizontalScroller.width() / @charWidth
|
||||
rows = @scroller.height() / @lineHeight
|
||||
columns = @scroller.width() / @charWidth
|
||||
|
||||
start = new Point(@scrollTop() / @lineHeight, @horizontalScroller.scrollLeft() / @charWidth)
|
||||
start = new Point(@scroller.scrollTop() / @lineHeight, @scroller.scrollLeft() / @charWidth)
|
||||
end = new Point(start.row + rows, start.column + columns)
|
||||
|
||||
new Range(start, end)
|
||||
|
||||
Reference in New Issue
Block a user