From f9fb93f214b11db61dccdfabde0b25f24d3d7a18 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 25 Mar 2016 16:37:01 +0100 Subject: [PATCH] :art: --- spec/fake-lines-yardstick.coffee | 41 +++++++++++++++++++------------- src/text-editor.coffee | 4 ---- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/spec/fake-lines-yardstick.coffee b/spec/fake-lines-yardstick.coffee index 085ab4bde..c3396ff9f 100644 --- a/spec/fake-lines-yardstick.coffee +++ b/spec/fake-lines-yardstick.coffee @@ -32,25 +32,32 @@ class FakeLinesYardstick column = 0 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) + startIndex = 0 + {tagCodes, lineText} = @model.screenLineForScreenRow(targetRow) + for tagCode in tagCodes + if @displayLayer.isOpenTagCode(tagCode) + scopes.push(@displayLayer.tagForCode(tagCode)) + else if @displayLayer.isCloseTagCode(tagCode) + scopes.splice(scopes.lastIndexOf(@displayLayer.tagForCode(tagCode)), 1) + else + text = lineText.substr(startIndex, tagCode) + startIndex += tagCode + characterWidths = @getScopedCharacterWidths(scopes) - 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] ? @model.getDefaultCharWidth() unless char is '\0' - column += charLength + left += characterWidths[char] ? @model.getDefaultCharWidth() unless char is '\0' + column += charLength {top, left} diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 7b77e4403..958c1d8ec 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2971,10 +2971,6 @@ class TextEditor extends Model destroyFoldsIntersectingBufferRange: (bufferRange) -> @displayLayer.destroyFoldsIntersectingBufferRange(bufferRange) - # {Delegates to: DisplayLayer.outermostFoldsForBufferRowRange} - outermostFoldsInBufferRowRange: (startRow, endRow) -> - @displayLayer.outermostFoldsInBufferRowRange(startRow, endRow) - ### Section: Gutters ###