From 6977660699a377ef6ecf8a7c8913deefa28e86a1 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 4 Feb 2015 07:59:34 -0700 Subject: [PATCH] =?UTF-8?q?Store=20=E2=80=98isOnlyWhitespace=E2=80=99=20in?= =?UTF-8?q?=20line=20presenter=20state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lines-component.coffee | 5 ++--- src/text-editor-presenter.coffee | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 7334c4b81..386583534 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -169,14 +169,13 @@ LinesComponent = React.createClass buildLineInnerHTML: (id) -> {editor} = @props {indentGuidesVisible} = @newState - {tokens, text} = @newState.lines[id] + {tokens, text, isOnlyWhitespace} = @newState.lines[id] innerHTML = "" scopeStack = [] - lineIsWhitespaceOnly = line.isOnlyWhitespace() for token in tokens innerHTML += @updateScopeStack(scopeStack, token.scopes) - hasIndentGuide = indentGuidesVisible and (token.hasLeadingWhitespace() or (token.hasTrailingWhitespace() and lineIsWhitespaceOnly)) + hasIndentGuide = indentGuidesVisible and (token.hasLeadingWhitespace() or (token.hasTrailingWhitespace() and isOnlyWhitespace)) innerHTML += token.getValueAsHtml({hasIndentGuide}) innerHTML += @popScope(scopeStack) while scopeStack.length > 0 diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index aeff452a5..7e88c0a87 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -181,6 +181,7 @@ class TextEditorPresenter screenRow: row text: line.text tokens: line.tokens + isOnlyWhitespace: line.isOnlyWhitespace() endOfLineInvisibles: line.endOfLineInvisibles indentLevel: line.indentLevel tabLength: line.tabLength