Use bufferRowsForScreenRows to compute line numbers

This commit is contained in:
Antonio Scandurra
2017-05-10 13:45:19 +02:00
parent ab20fc3b19
commit 955cf98feb
2 changed files with 5 additions and 6 deletions

View File

@@ -819,8 +819,9 @@ class TextEditorComponent {
const endRow = this.getRenderedEndRow()
const renderedRowCount = this.getRenderedRowCount()
const {bufferRows, keys, softWrappedFlags, foldableFlags} = this.lineNumbersToRender
bufferRows.length = renderedRowCount
const {keys, softWrappedFlags, foldableFlags} = this.lineNumbersToRender
const bufferRows = model.bufferRowsForScreenRows(startRow, endRow)
this.lineNumbersToRender.bufferRows = bufferRows
keys.length = renderedRowCount
foldableFlags.length = renderedRowCount
@@ -828,8 +829,7 @@ class TextEditorComponent {
let softWrapCount = 0
for (let row = startRow; row < endRow; row++) {
const i = row - startRow
const bufferRow = model.bufferRowForScreenRow(row)
bufferRows[i] = bufferRow
const bufferRow = bufferRows[i]
if (bufferRow === previousBufferRow) {
softWrapCount++
softWrappedFlags[i] = true

View File

@@ -1039,8 +1039,7 @@ class TextEditor extends Model
@displayLayer.translateScreenPosition(Point(screenRow, 0)).row
bufferRowsForScreenRows: (startScreenRow, endScreenRow) ->
for screenRow in [startScreenRow..endScreenRow]
@bufferRowForScreenRow(screenRow)
@displayLayer.bufferRowsForScreenRows(startScreenRow, endScreenRow)
screenRowForBufferRow: (row) ->
@displayLayer.translateBufferPosition(Point(row, 0)).row