Fix a 🐛 where some invalid lines were being measured

This commit is contained in:
Antonio Scandurra
2015-09-30 17:44:26 +02:00
parent bca3be32e6
commit 2b6973d4b1
2 changed files with 28 additions and 11 deletions

View File

@@ -30,6 +30,7 @@ class TextEditorPresenter
@lineDecorationsByScreenRow = {}
@lineNumberDecorationsByScreenRow = {}
@customGutterDecorationsByGutterNameAndScreenRow = {}
@screenRowsToMeasure = []
@transferMeasurementsToModel()
@transferMeasurementsFromModel()
@observeModel()
@@ -370,8 +371,8 @@ class TextEditorPresenter
screenRows = [startRow...endRow]
if longestScreenRow = @model.getLongestScreenRow()
screenRows.push(longestScreenRow)
if @screenRowsToMeasure?
screenRows.push(@screenRowsToMeasure...)
for row in @screenRowsToMeasure when @constrainRow(row) is row
screenRows.push(row)
screenRows.sort (a, b) -> a - b
_.uniq(screenRows, true)
@@ -384,14 +385,6 @@ class TextEditorPresenter
@shouldUpdateLineNumbersState = true
@shouldUpdateDecorations = true
clearScreenRowsToMeasure: ->
return if not screenRows? or screenRows.length is 0
@screenRowsToMeasure = []
@shouldUpdateLinesState = true
@shouldUpdateLineNumbersState = true
@shouldUpdateDecorations = true
updateTilesState: ->
return unless @startRow? and @endRow? and @lineHeight?
@@ -403,7 +396,7 @@ class TextEditorPresenter
zIndex = 0
for tileStartRow in [@tileForRow(endRow)..@tileForRow(startRow)] by -@tileSize
tileEndRow = Math.min(@model.getScreenLineCount(), tileStartRow + @tileSize)
tileEndRow = @constrainRow(tileStartRow + @tileSize)
rowsWithinTile = []
while screenRowIndex >= 0