mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Switch character measurement to TokenIterator
Instead of using TokenizedLine::tokens shim
This commit is contained in:
@@ -354,19 +354,22 @@ class LinesComponent
|
||||
iterator = null
|
||||
charIndex = 0
|
||||
|
||||
for {value, scopes, hasPairedCharacter} in tokenizedLine.tokens
|
||||
tokenIterator = TokenIterator.instance.reset(tokenizedLine)
|
||||
while tokenIterator.next()
|
||||
scopes = tokenIterator.getScopes()
|
||||
text = tokenIterator.getText()
|
||||
charWidths = @presenter.getScopedCharacterWidths(scopes)
|
||||
|
||||
valueIndex = 0
|
||||
while valueIndex < value.length
|
||||
if hasPairedCharacter
|
||||
char = value.substr(valueIndex, 2)
|
||||
textIndex = 0
|
||||
while textIndex < text.length
|
||||
if tokenIterator.isPairedCharacter()
|
||||
char = text
|
||||
charLength = 2
|
||||
valueIndex += 2
|
||||
textIndex += 2
|
||||
else
|
||||
char = value[valueIndex]
|
||||
char = text[textIndex]
|
||||
charLength = 1
|
||||
valueIndex++
|
||||
textIndex++
|
||||
|
||||
continue if char is '\0'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user