mirror of
https://github.com/atom/atom.git
synced 2026-01-29 00:38:11 -05:00
💚 Use tokenizedLine.id to refer to lines
This commit is contained in:
@@ -15,7 +15,7 @@ class MockLineNodesProvider
|
||||
|
||||
setDefaultFont: (font) -> @defaultFont = font
|
||||
|
||||
lineNodeForScreenRow: (screenRow) ->
|
||||
lineNodeForLineIdAndScreenRow: (id, screenRow) ->
|
||||
lineNode = document.createElement("div")
|
||||
lineNode.style.whiteSpace = "pre"
|
||||
lineState = @editor.tokenizedLineForScreenRow(screenRow)
|
||||
|
||||
@@ -320,6 +320,9 @@ class LinesTileComponent
|
||||
lineNodeForScreenRow: (screenRow) ->
|
||||
@lineNodesByLineId[@lineIdsByScreenRow[screenRow]]
|
||||
|
||||
lineNodeForLineId: (lineId) ->
|
||||
@lineNodesByLineId[lineId]
|
||||
|
||||
measureCharactersInNewLines: ->
|
||||
for id, lineState of @oldTileState.lines
|
||||
unless @measuredLines.has(id)
|
||||
|
||||
@@ -22,10 +22,14 @@ class LinesYardstick
|
||||
{top, left}
|
||||
|
||||
leftPixelPositionForScreenPosition: (row, column) ->
|
||||
lineNode = @lineNodesProvider.lineNodeForScreenRow(row)
|
||||
tokenizedLine = @model.tokenizedLineForScreenRow(row)
|
||||
return 0 unless tokenizedLine?
|
||||
|
||||
lineNode =
|
||||
@lineNodesProvider.lineNodeForLineIdAndScreenRow(tokenizedLine.id, row)
|
||||
|
||||
return 0 unless lineNode?
|
||||
tokenizedLine = @model.tokenizedLineForScreenRow(row)
|
||||
|
||||
iterator = document.createNodeIterator(lineNode, NodeFilter.SHOW_TEXT, AcceptFilter)
|
||||
charIndex = 0
|
||||
|
||||
|
||||
@@ -743,6 +743,12 @@ class TextEditorComponent
|
||||
consolidateSelections: (e) ->
|
||||
e.abortKeyBinding() unless @editor.consolidateSelections()
|
||||
|
||||
lineNodeForLineIdAndScreenRow: (lineId, screenRow) ->
|
||||
tileRow = @presenter.tileForRow(screenRow)
|
||||
tileComponent = @linesComponent.getComponentForTile(tileRow)
|
||||
|
||||
tileComponent?.lineNodeForLineId(lineId)
|
||||
|
||||
lineNodeForScreenRow: (screenRow) ->
|
||||
tileRow = @presenter.tileForRow(screenRow)
|
||||
tileComponent = @linesComponent.getComponentForTile(tileRow)
|
||||
|
||||
Reference in New Issue
Block a user