mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Vertical scrollbar height is updated when switching buffers
This commit is contained in:
@@ -130,6 +130,14 @@ describe "Editor", ->
|
||||
editor.setBuffer(buffer)
|
||||
expect(otherBuffer.subscriptionCount()).toBe previousSubscriptionCount
|
||||
|
||||
it "resizes the vertical scrollbar based on the new buffer's height", ->
|
||||
editor.attachToDom(heightInLines: 5)
|
||||
originalHeight = editor.verticalScrollbar.prop('scrollHeight')
|
||||
expect(originalHeight).toBeGreaterThan 0
|
||||
|
||||
editor.setBuffer(new Buffer(require.resolve('fixtures/sample.txt')))
|
||||
expect(editor.verticalScrollbar.prop('scrollHeight')).toBeLessThan originalHeight
|
||||
|
||||
describe ".clipScreenPosition(point)", ->
|
||||
it "selects the nearest valid position to the given point", ->
|
||||
expect(editor.clipScreenPosition(row: 1000, column: 0)).toEqual(row: buffer.getLastRow(), column: buffer.lineForRow(buffer.getLastRow()).length)
|
||||
|
||||
@@ -344,7 +344,9 @@ class Editor extends View
|
||||
@buffer.on "path-change.editor#{@id}", => @trigger 'editor-path-change'
|
||||
|
||||
@renderer = new Renderer(@buffer, { maxLineLength: @calcMaxLineLength(), tabText: @tabText })
|
||||
@renderLines() if @attached
|
||||
if @attached
|
||||
@prepareForVerticalScrolling()
|
||||
@renderLines()
|
||||
|
||||
@loadEditSessionForBuffer(@buffer)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user