mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-29 01:27:00 +03:00
Don't add CR invisible if line is soft wrapped
This commit is contained in:
parent
fa5ceedfe0
commit
d84c600679
@ -1632,6 +1632,21 @@ describe "Editor", ->
|
||||
expect(editor.renderedLines.find('.line:first').text()).toBe "a line#{space}"
|
||||
expect(editor.renderedLines.find('.line:last').text()).toBe "wraps#{eol}"
|
||||
|
||||
it "displays trailing carriage return using a visible non-empty value", ->
|
||||
editor.setSoftWrapColumn(6)
|
||||
editor.setText "a line that\r\n"
|
||||
editor.attachToDom()
|
||||
config.set "editor.showInvisibles", true
|
||||
space = editor.invisibles?.space
|
||||
expect(space).toBeTruthy()
|
||||
cr = editor.invisibles?.cr
|
||||
expect(cr).toBeTruthy()
|
||||
eol = editor.invisibles?.eol
|
||||
expect(eol).toBeTruthy()
|
||||
expect(editor.renderedLines.find('.line:first').text()).toBe "a line#{space}"
|
||||
expect(editor.renderedLines.find('.line:eq(1)').text()).toBe "that#{cr}#{eol}"
|
||||
expect(editor.renderedLines.find('.line:last').text()).toBe "#{eol}"
|
||||
|
||||
describe "gutter rendering", ->
|
||||
beforeEach ->
|
||||
editor.attachToDom(heightInLines: 5.5)
|
||||
|
@ -1076,10 +1076,10 @@ class Editor extends View
|
||||
position += token.value.length
|
||||
|
||||
popScope() while scopeStack.length > 0
|
||||
if invisibles and not @mini
|
||||
if invisibles and not @mini and not screenLine.isSoftWrapped()
|
||||
if invisibles.cr and screenLine.lineEnding is '\r\n'
|
||||
line.push("<span class='invisible'>#{invisibles.cr}</span>")
|
||||
if invisibles.eol and not screenLine.isSoftWrapped()
|
||||
if invisibles.eol
|
||||
line.push("<span class='invisible'>#{invisibles.eol}</span>")
|
||||
|
||||
line.push('</pre>')
|
||||
|
@ -74,11 +74,13 @@ class ScreenLine
|
||||
bufferRows: 0
|
||||
startBufferColumn: @startBufferColumn
|
||||
ruleStack: @ruleStack
|
||||
lineEnding: @lineEnding
|
||||
)
|
||||
rightFragment = new ScreenLine(
|
||||
tokens: rightTokens
|
||||
startBufferColumn: @startBufferColumn + column
|
||||
ruleStack: @ruleStack
|
||||
lineEnding: @lineEnding
|
||||
)
|
||||
[leftFragment, rightFragment]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user