mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
Handle invisible character rendering when building HTML for lines.
Not during creation of tokens.
This commit is contained in:
@@ -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>')
|
||||
|
||||
Reference in New Issue
Block a user