diff --git a/src/editor-view.coffee b/src/editor-view.coffee index 1da0e223d..d1fcbcc29 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -1488,10 +1488,8 @@ class EditorView extends View position = 0 for token in tokens @updateScopeStack(line, scopeStack, token.scopes) - hasLeadingWhitespace = position < firstNonWhitespacePosition - hasTrailingWhitespace = position + token.value.length > firstTrailingWhitespacePosition hasIndentGuide = not mini and showIndentGuide and (hasLeadingWhitespace or lineIsWhitespaceOnly) - line.push(token.getValueAsHtml({invisibles, hasLeadingWhitespace, hasTrailingWhitespace, hasIndentGuide})) + line.push(token.getValueAsHtml({invisibles, hasIndentGuide})) position += token.value.length @popScope(line, scopeStack) while scopeStack.length > 0 diff --git a/src/token.coffee b/src/token.coffee index 17699f8f8..f42c5a9cc 100644 --- a/src/token.coffee +++ b/src/token.coffee @@ -129,7 +129,7 @@ class Token scopeClasses = scope.split('.') _.isSubset(targetClasses, scopeClasses) - getValueAsHtml: ({invisibles, hasLeadingWhitespace, hasTrailingWhitespace, hasIndentGuide})-> + getValueAsHtml: ({invisibles, hasIndentGuide})-> invisibles ?= {} if @isHardTab classes = 'hard-tab' @@ -144,7 +144,7 @@ class Token leadingHtml = '' trailingHtml = '' - if hasLeadingWhitespace and match = LeadingWhitespaceRegex.exec(@value) + if @hasLeadingWhitespace and match = LeadingWhitespaceRegex.exec(@value) classes = 'leading-whitespace' classes += ' indent-guide' if hasIndentGuide classes += ' invisible-character' if invisibles.space @@ -154,9 +154,9 @@ class Token startIndex = match[0].length - if hasTrailingWhitespace and match = TrailingWhitespaceRegex.exec(@value) + if @hasTrailingWhitespace and match = TrailingWhitespaceRegex.exec(@value) classes = 'trailing-whitespace' - classes += ' indent-guide' if hasIndentGuide and not hasLeadingWhitespace + classes += ' indent-guide' if hasIndentGuide and not @hasLeadingWhitespace classes += ' invisible-character' if invisibles.space match[0] = match[0].replace(CharacterRegex, invisibles.space) if invisibles.space