mirror of
https://github.com/atom/atom.git
synced 2026-01-25 14:59:03 -05:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user