mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Update buffer-row and screen-row data fields on each line number node
This commit is contained in:
@@ -685,6 +685,20 @@ describe('TextEditorComponent', () => {
|
||||
])
|
||||
}
|
||||
|
||||
editor.getBuffer().insert([2, 0], '\n')
|
||||
await component.getNextUpdatePromise()
|
||||
{
|
||||
const bufferRows = Array.from(element.querySelectorAll('.line-number:not(.dummy)')).map((e) => e.dataset.bufferRow)
|
||||
const screenRows = Array.from(element.querySelectorAll('.line-number:not(.dummy)')).map((e) => e.dataset.screenRow)
|
||||
expect(bufferRows).toEqual([
|
||||
'0', '1', '2', '3', '4', '4', '5', '6', '7', '7',
|
||||
'7', '8', '9', '9', '9', '10', '11', '12', '12', '13'
|
||||
])
|
||||
expect(screenRows).toEqual([
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'10', '11', '12', '13', '14', '15', '16', '17', '18', '19'
|
||||
])
|
||||
}
|
||||
})
|
||||
|
||||
it('does not blow away class names added to the element by packages when changing the class name', async () => {
|
||||
|
||||
@@ -3167,8 +3167,10 @@ class LineNumberComponent {
|
||||
}
|
||||
|
||||
update (props) {
|
||||
const {nodePool, className, width, marginTop, number} = props
|
||||
const {nodePool, className, width, marginTop, bufferRow, screenRow, number} = props
|
||||
|
||||
if (this.props.bufferRow !== bufferRow) this.element.dataset.bufferRow = bufferRow
|
||||
if (this.props.screenRow !== screenRow) this.element.dataset.screenRow = screenRow
|
||||
if (this.props.className !== className) this.element.className = className
|
||||
if (this.props.width !== width) this.element.style.width = width + 'px'
|
||||
if (this.props.marginTop !== marginTop) {
|
||||
|
||||
Reference in New Issue
Block a user