From 9b5593d020089aba457cae0afccbc6da244afe2f Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 19 May 2014 17:27:59 -0700 Subject: [PATCH] Put EOL invisibles into their own scope --- spec/editor-component-spec.coffee | 2 ++ src/lines-component.coffee | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index 8a7d22421..c9ccab8bd 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -106,6 +106,8 @@ describe "EditorComponent", -> expect(component.lineNodeForScreenRow(0).textContent).toBe "#{invisibles.space}a line with tabs#{invisibles.tab} and spaces#{invisibles.space}#{invisibles.eol}" it "displays newlines as their own token outside of the other tokens scope", -> + editor.setText "var" + expect(component.lineNodeForScreenRow(0).innerHTML).toBe "var#{invisibles.eol}" it "allows invisible glyphs to be customized via the editor.invisibles config", -> diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 27a3c0660..8de0963ee 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -146,8 +146,9 @@ LinesComponent = React.createClass innerHTML += @updateScopeStack(scopeStack, token.scopes) hasIndentGuide = not mini and showIndentGuide and token.hasLeadingWhitespace or (token.hasTrailingWhitespace and lineIsWhitespaceOnly) innerHTML += token.getValueAsHtml({invisibles, hasIndentGuide}) + innerHTML += @popScope(scopeStack) while scopeStack.length > 0 - innerHTML += invisibles.eol if invisibles.eol? + innerHTML += "#{invisibles.eol}" innerHTML updateScopeStack: (scopeStack, desiredScopes) ->