Adjust Editor.scrollTop when removing a line reduces the scroll height

This eliminates rendering artifacts and jerky scrolling at the bottom of the screen
This commit is contained in:
Nathan Sobo
2012-07-03 11:12:54 -06:00
parent 3ee7c0dc0f
commit bdfdf08ea0
2 changed files with 38 additions and 1 deletions

View File

@@ -658,6 +658,11 @@ class Editor extends View
adjustWidthOfRenderedLines: ->
@renderedLines.width(@charWidth * @maxScreenLineLength())
handleScrollHeightChange: ->
scrollHeight = @lineHeight * @screenLineCount()
@verticalScrollbarContent.height(scrollHeight)
@scrollBottom(scrollHeight) if @scrollBottom() > scrollHeight
renderLines: ->
@clearRenderedLines()
@updateRenderedLines()
@@ -717,7 +722,7 @@ class Editor extends View
newScreenRange = e.newRange
if @attached
@verticalScrollbarContent.height(@lineHeight * @screenLineCount())
@handleScrollHeightChange() unless newScreenRange.coversSameRows(oldScreenRange)
@adjustWidthOfRenderedLines()
return if oldScreenRange.start.row > @lastRenderedScreenRow