Don't add EOL invisible if line is soft wrapped

This commit is contained in:
Kevin Sawicki 2013-01-28 13:22:32 -08:00
parent 6218b58fd4
commit fa5ceedfe0
2 changed files with 15 additions and 1 deletions

View File

@ -1618,6 +1618,20 @@ describe "Editor", ->
expect(eol).toBeTruthy()
expect(editor.renderedLines.find('.line:first').text()).toBe "a line that ends with a carriage return#{cr}#{eol}"
describe "when wrapping is on", ->
it "doesn't show the end of line invisible at the end of lines broken due to wrapping", ->
editor.setSoftWrapColumn(6)
editor.setText "a line that wraps"
editor.attachToDom()
config.set "editor.showInvisibles", true
space = editor.invisibles?.space
expect(space).toBeTruthy()
eol = editor.invisibles?.eol
expect(eol).toBeTruthy()
expect(editor.renderedLines.find('.line:first').text()).toBe "a line#{space}"
expect(editor.renderedLines.find('.line:last').text()).toBe "wraps#{eol}"
describe "gutter rendering", ->
beforeEach ->
editor.attachToDom(heightInLines: 5.5)

View File

@ -1079,7 +1079,7 @@ class Editor extends View
if invisibles and not @mini
if invisibles.cr and screenLine.lineEnding is '\r\n'
line.push("<span class='invisible'>#{invisibles.cr}</span>")
if invisibles.eol
if invisibles.eol and not screenLine.isSoftWrapped()
line.push("<span class='invisible'>#{invisibles.eol}</span>")
line.push('</pre>')