From 0ca967d6b018d84ef23d104d2d5c815d3fa2d529 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 14 May 2015 01:10:29 +0200 Subject: [PATCH] Switch character measurement to TokenIterator Instead of using TokenizedLine::tokens shim --- src/lines-component.coffee | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 80b32b88b..8fa7c215f 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -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'