Put EOL invisibles into their own scope

This commit is contained in:
probablycorey
2014-05-19 17:27:59 -07:00
parent 4d642b91ef
commit 9b5593d020
2 changed files with 4 additions and 1 deletions

View File

@@ -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 "<span class=\"source js\"><span class=\"storage modifier js\">var</span></span><span class=\"invisible-character\">#{invisibles.eol}</span>"
it "allows invisible glyphs to be customized via the editor.invisibles config", ->

View File

@@ -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 += "<span class='invisible-character'>#{invisibles.eol}</span>"
innerHTML
updateScopeStack: (scopeStack, desiredScopes) ->