mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add proper invisibles in empty lines with indent guide
This fixes a regression where multiple end of line invisibles were displayed on empty lines when the indent guide was also enabled. The invisibles array used to be shifted and not it isn't but the entire array was still being iterated over causing extra invisibles to be added to the line.
This commit is contained in:
@@ -1644,12 +1644,14 @@ describe "Editor", ->
|
||||
|
||||
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').length).toBe 1
|
||||
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').text()).toBe "#{eol} "
|
||||
expect(editor.renderedLines.find('.line:eq(10) .invisible-character').text()).toBe eol
|
||||
|
||||
editor.setCursorBufferPosition([9])
|
||||
editor.indent()
|
||||
|
||||
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').length).toBe 2
|
||||
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').text()).toBe "#{eol} "
|
||||
expect(editor.renderedLines.find('.line:eq(10) .invisible-character').text()).toBe eol
|
||||
|
||||
describe "when soft-wrap is enabled", ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -1771,8 +1771,8 @@ class Editor extends View
|
||||
indentLevelHtml += "</span>"
|
||||
indentGuideHtml += indentLevelHtml
|
||||
|
||||
for invisible in eolInvisibles
|
||||
indentGuideHtml += "<span class='invisible-character'>#{invisible}</span>"
|
||||
while indentCharIndex < eolInvisibles.length
|
||||
indentGuideHtml += "<span class='invisible-character'>#{eolInvisibles[indentCharIndex++]}</span>"
|
||||
|
||||
return indentGuideHtml
|
||||
|
||||
|
||||
Reference in New Issue
Block a user