mirror of
https://github.com/atom/atom.git
synced 2026-01-27 07:47:58 -05:00
Start integrating the yardstick
This commit is contained in:
@@ -68,14 +68,15 @@ class TextEditorPresenter
|
||||
@updating is false
|
||||
|
||||
getStateForMeasurements: (screenRows) ->
|
||||
screenRows = _.uniq(screenRows.concat(@getVisibleRows()))
|
||||
|
||||
@updateVerticalDimensions()
|
||||
@updateScrollbarDimensions()
|
||||
@updateStartRow()
|
||||
@updateEndRow()
|
||||
|
||||
@updateTilesState(screenRows)
|
||||
screenRows = _.without(screenRows, null, undefined, @getVisibleRows()...)
|
||||
|
||||
@updateVisibleTilesState() if @shouldUpdateLineNumbersState or @shouldUpdateLinesState
|
||||
@updateTilesState(screenRows, true)
|
||||
|
||||
@state
|
||||
|
||||
@@ -84,10 +85,11 @@ class TextEditorPresenter
|
||||
getState: ->
|
||||
@updating = true
|
||||
|
||||
@updateVerticalDimensions()
|
||||
@updateScrollbarDimensions()
|
||||
@updateStartRow()
|
||||
@updateEndRow()
|
||||
@linesYardstick.prepareScreenRowsForMeasurement([
|
||||
@model.getLongestScreenRow()
|
||||
])
|
||||
@deleteTemporaryTiles()
|
||||
|
||||
@updateCommonGutterState()
|
||||
@updateHorizontalDimensions()
|
||||
@updateReflowState()
|
||||
@@ -359,11 +361,16 @@ class TextEditorPresenter
|
||||
[startRow...endRow]
|
||||
|
||||
updateVisibleTilesState: ->
|
||||
return unless @startRow? and @endRow? and @lineHeight?
|
||||
|
||||
@updateTilesState(@getVisibleRows())
|
||||
|
||||
updateTilesState: (screenRows) ->
|
||||
deleteTemporaryTiles: ->
|
||||
for tileId, tileState of @state.content.tiles when tileState.temporary
|
||||
delete @state.content.tiles[tileId]
|
||||
delete @lineNumberGutter.tiles[tileId]
|
||||
|
||||
updateTilesState: (screenRows, temporary = false) ->
|
||||
return unless @startRow? and @endRow? and @lineHeight?
|
||||
|
||||
screenRows.sort (a, b) -> a - b
|
||||
|
||||
visibleTiles = {}
|
||||
@@ -391,12 +398,14 @@ class TextEditorPresenter
|
||||
tile.display = "block"
|
||||
tile.zIndex = zIndex
|
||||
tile.highlights ?= {}
|
||||
tile.temporary = temporary
|
||||
|
||||
gutterTile = @lineNumberGutter.tiles[tileStartRow] ?= {}
|
||||
gutterTile.top = tileStartRow * @lineHeight - @scrollTop
|
||||
gutterTile.height = @tileSize * @lineHeight
|
||||
gutterTile.display = "block"
|
||||
gutterTile.zIndex = zIndex
|
||||
gutterTile.temporary = temporary
|
||||
|
||||
@updateLinesState(tile, rowsWithinTile) if @shouldUpdateLinesState
|
||||
@updateLineNumbersState(gutterTile, rowsWithinTile) if @shouldUpdateLineNumbersState
|
||||
@@ -404,6 +413,8 @@ class TextEditorPresenter
|
||||
visibleTiles[tileStartRow] = true
|
||||
zIndex++
|
||||
|
||||
return if temporary
|
||||
|
||||
if @mouseWheelScreenRow? and @model.tokenizedLineForScreenRow(@mouseWheelScreenRow)?
|
||||
mouseWheelTile = @tileForRow(@mouseWheelScreenRow)
|
||||
|
||||
@@ -424,7 +435,7 @@ class TextEditorPresenter
|
||||
for screenRow in screenRows
|
||||
line = @model.tokenizedLineForScreenRow(screenRow)
|
||||
unless line?
|
||||
throw new Error("No line exists for row #{row}. Last screen row: #{@model.getLastScreenRow()}")
|
||||
throw new Error("No line exists for row #{screenRow}. Last screen row: #{@model.getLastScreenRow()}")
|
||||
|
||||
visibleLineIds[line.id] = true
|
||||
if tileState.lines.hasOwnProperty(line.id)
|
||||
|
||||
Reference in New Issue
Block a user