Empty lines require a special case for invisibles.

This commit is contained in:
Corey Johnson
2012-10-11 17:06:34 -07:00
committed by Corey Johnson & Nathan Sobo
parent 1ffbff7d99
commit d7bc03112b
2 changed files with 7 additions and 8 deletions

View File

@@ -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("&nbsp;")
line.push('</pre>')
line.join('')

View File

@@ -41,13 +41,9 @@ class Token
tabText = new Array(tabLength + 1).join(" ")
escapeValue: (showInvisibles)->
return "&nbsp;" if @value == ""
value = @value
@value
.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
value