mirror of
https://github.com/atom/atom.git
synced 2026-02-15 17:15:24 -05:00
More fixes in FakeLinesYardstick
This commit is contained in:
@@ -26,33 +26,31 @@ class FakeLinesYardstick
|
||||
|
||||
targetRow = screenPosition.row
|
||||
targetColumn = screenPosition.column
|
||||
baseCharacterWidth = @model.getDefaultCharWidth()
|
||||
|
||||
top = @lineTopIndex.pixelPositionAfterBlocksForRow(targetRow)
|
||||
left = 0
|
||||
column = 0
|
||||
|
||||
for {tokens} in @displayLayer.getScreenLines(targetRow, targetRow + 1)[0]
|
||||
scopes = []
|
||||
for {text, closeTags, openTags} in tokens
|
||||
scopes.splice(scopes.lastIndexOf(closeTag), 1) for closeTag in closeTags
|
||||
scopes.push(openTag) for openTag in openTags
|
||||
scopes = []
|
||||
for {text, closeTags, openTags} in @displayLayer.getScreenLines(targetRow, targetRow + 1)[0].tokens
|
||||
scopes.splice(scopes.lastIndexOf(closeTag), 1) for closeTag in closeTags
|
||||
scopes.push(openTag) for openTag in openTags
|
||||
characterWidths = @getScopedCharacterWidths(scopes)
|
||||
|
||||
characterWidths = @getScopedCharacterWidths(iterator.getScopes())
|
||||
valueIndex = 0
|
||||
while valueIndex < text.length
|
||||
if isPairedCharacter(text, valueIndex)
|
||||
char = text[valueIndex...valueIndex + 2]
|
||||
charLength = 2
|
||||
valueIndex += 2
|
||||
else
|
||||
char = text[valueIndex]
|
||||
charLength = 1
|
||||
valueIndex++
|
||||
valueIndex = 0
|
||||
while valueIndex < text.length
|
||||
if isPairedCharacter(text, valueIndex)
|
||||
char = text[valueIndex...valueIndex + 2]
|
||||
charLength = 2
|
||||
valueIndex += 2
|
||||
else
|
||||
char = text[valueIndex]
|
||||
charLength = 1
|
||||
valueIndex++
|
||||
|
||||
break if column is targetColumn
|
||||
break if column is targetColumn
|
||||
|
||||
left += characterWidths[char] ? baseCharacterWidth unless char is '\0'
|
||||
column += charLength
|
||||
left += characterWidths[char] ? @model.getDefaultCharWidth() unless char is '\0'
|
||||
column += charLength
|
||||
|
||||
{top, left}
|
||||
|
||||
Reference in New Issue
Block a user