mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Use explicit state to recycle tiles instead of modulo scheme
This avoids updating tiles unnecessarily when changing the number of rendered tiles. Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Nathan Sobo
parent
7f3794b12e
commit
be2aaa0b22
@@ -186,6 +186,15 @@ describe('TextEditorComponent', () => {
|
||||
expect(component.refs.lineTiles.children.length).toBe(3)
|
||||
})
|
||||
|
||||
it('recycles tiles on resize', async () => {
|
||||
const {component, element, editor} = buildComponent({rowsPerTile: 2, autoHeight: false})
|
||||
await setEditorHeightInLines(component, 7)
|
||||
await setScrollTop(component, 3.5 * component.getLineHeight())
|
||||
const lineNode = lineNodeForScreenRow(component, 7)
|
||||
await setEditorHeightInLines(component, 4)
|
||||
expect(lineNodeForScreenRow(component, 7)).toBe(lineNode)
|
||||
})
|
||||
|
||||
it('renders dummy vertical and horizontal scrollbars when content overflows', async () => {
|
||||
const {component, element, editor} = buildComponent({height: 100, width: 100})
|
||||
const verticalScrollbar = component.refs.verticalScrollbar.element
|
||||
@@ -3425,7 +3434,7 @@ function clientPositionForCharacter (component, row, column) {
|
||||
function lineNumberNodeForScreenRow (component, row) {
|
||||
const gutterElement = component.refs.gutterContainer.refs.lineNumberGutter.element
|
||||
const tileStartRow = component.tileStartRowForRow(row)
|
||||
const tileIndex = component.tileIndexForTileStartRow(tileStartRow)
|
||||
const tileIndex = component.renderedTileStartRows.indexOf(tileStartRow)
|
||||
return gutterElement.children[tileIndex + 1].children[row - tileStartRow]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user