mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Empty lines require a special case for invisibles.
This commit is contained in:
committed by
Corey Johnson & Nathan Sobo
parent
1ffbff7d99
commit
d7bc03112b
@@ -873,12 +873,15 @@ class Editor extends View
|
||||
attributePairs.push "#{attributeName}=\"#{value}\"" for attributeName, value of lineAttributes
|
||||
line.push("<pre #{attributePairs.join(' ')}>")
|
||||
|
||||
for token in screenLine.tokens
|
||||
updateScopeStack(token.scopes)
|
||||
line.push(token.escapeValue(@activeEditSession.showInvisibles))
|
||||
unless screenLine.text == ''
|
||||
for token in screenLine.tokens
|
||||
updateScopeStack(token.scopes)
|
||||
line.push(token.escapeValue(@activeEditSession.showInvisibles))
|
||||
|
||||
if @activeEditSession.showInvisibles
|
||||
line.push("<span class='invisible'>¬</span>")
|
||||
else if screenLine.text == ''
|
||||
line.push(" ")
|
||||
|
||||
line.push('</pre>')
|
||||
line.join('')
|
||||
|
||||
@@ -41,13 +41,9 @@ class Token
|
||||
tabText = new Array(tabLength + 1).join(" ")
|
||||
|
||||
escapeValue: (showInvisibles)->
|
||||
return " " if @value == ""
|
||||
|
||||
value = @value
|
||||
@value
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
|
||||
value
|
||||
|
||||
Reference in New Issue
Block a user