Handle invisible character rendering when building HTML for lines.

Not during creation of tokens.
This commit is contained in:
Corey Johnson & Nathan Sobo
2012-10-18 11:43:17 -07:00
parent dd5a10e82e
commit b33bbbfc0d
6 changed files with 57 additions and 97 deletions

View File

@@ -876,9 +876,18 @@ class Editor extends View
if screenLine.text == ''
line.push(" ") unless @activeEditSession.showInvisibles
else
firstNonWhitespacePosition = screenLine.text.search(/\S/)
firstTrailingWhitespacePosition = screenLine.text.search(/\s*$/)
position = 0
for token in screenLine.tokens
updateScopeStack(token.scopes)
line.push(token.escapeValue(@activeEditSession.showInvisibles))
line.push(token.getValueAsHtml(
showInvisibles: @activeEditSession.showInvisibles
hasLeadingWhitespace: position < firstNonWhitespacePosition
hasTrailingWhitespace: position + token.value.length > firstTrailingWhitespacePosition
))
position += token.value.length
line.push("<span class='invisible'>¬</span>") if @activeEditSession.showInvisibles
line.push('</pre>')