Store autoscroll state on Selection and Cursor models

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-11-30 12:08:33 -07:00
parent b9e847d290
commit be2b9ee100
5 changed files with 26 additions and 7 deletions

View File

@@ -794,13 +794,13 @@ class Editor extends View
do (cursorView) -> cursorView.resetBlinking()
autoscroll: (options={}) ->
for cursorView in @getCursorViews() when cursorView.needsAutoscroll
for cursorView in @getCursorViews() when cursorView.needsAutoscroll()
@scrollTo(cursorView.getPixelPosition()) unless options.suppressAutoScroll
cursorView.needsAutoscroll = false
cursorView.autoscrolled()
for selectionView in @getSelectionViews() when selectionView.selection.needsAutoscroll
for selectionView in @getSelectionViews() when selectionView.needsAutoscroll()
@scrollTo(selectionView.getCenterPixelPosition(), center: true)
selectionView.selection.needsAutoscroll = false
selectionView.autoscrolled()
updateRenderedLines: ->
firstVisibleScreenRow = @getFirstVisibleScreenRow()