More fixes in FakeLinesYardstick

This commit is contained in:
Antonio Scandurra
2016-03-17 09:28:48 +01:00
parent 2e41e9ead4
commit 670123a9f7

View File

@@ -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}