Render trailing carriage return as an invisible

This commit is contained in:
Kevin Sawicki
2013-01-27 12:54:23 -08:00
committed by Kevin Sawicki & Nathan Sobo
parent c16acc6b2c
commit ecc50506c7
3 changed files with 20 additions and 2 deletions

View File

@@ -311,9 +311,10 @@ class Editor extends View
setInvisibles: (@invisibles={}) ->
_.defaults @invisibles,
eol: '\u00ac',
space: '\u2022',
eol: '\u00ac'
space: '\u2022'
tab: '\u00bb'
cr: '\u00a4'
@resetDisplay()
checkoutHead: -> @getBuffer().checkoutHead()

View File

@@ -80,5 +80,8 @@ class Token
if hasTrailingWhitespace
html = html.replace /[ ]+$/, (match) ->
"<span class='invisible'>#{match.replace(/./g, invisibles.space)}</span>"
if invisibles.cr
html = html.replace /\r$/, (match) ->
"<span class='invisible'>#{invisibles.cr}</span>"
html