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:
Kevin Sawicki
2013-10-17 18:31:59 -07:00
parent 60dcef26b0
commit 069208975c
2 changed files with 4 additions and 2 deletions

View File

@@ -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 ->

View File

@@ -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