From 314833bbac33bdb7c45594550d8d10559dd2de9c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 19 May 2014 08:52:06 -0700 Subject: [PATCH] Add missing parens on indent guide check Previously the indent guide was always showing on the whitespace only lines Closes #2274 --- spec/editor-view-spec.coffee | 7 +++++++ src/editor-view.coffee | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/editor-view-spec.coffee b/spec/editor-view-spec.coffee index d01ed45e5..fac5bc28a 100644 --- a/spec/editor-view-spec.coffee +++ b/spec/editor-view-spec.coffee @@ -1803,6 +1803,13 @@ describe "EditorView", -> expect(editorView.renderedLines.find('.line:eq(10) .indent-guide').text()).toBe "#{eol} " expect(editorView.renderedLines.find('.line:eq(10) .invisible-character').text()).toBe eol + describe "when editor.showIndentGuide is set to false", -> + it "does not render the indent guide on whitespace only lines (regression)", -> + editorView.attachToDom() + editor.setText(' ') + atom.config.set('editor.showIndentGuide', false) + expect(editorView.renderedLines.find('.line:eq(0) .indent-guide').length).toBe 0 + describe "when soft-wrap is enabled", -> beforeEach -> jasmine.unspy(window, 'setTimeout') diff --git a/src/editor-view.coffee b/src/editor-view.coffee index 6aa18dd2a..2b69becd1 100644 --- a/src/editor-view.coffee +++ b/src/editor-view.coffee @@ -1490,7 +1490,7 @@ class EditorView extends View position = 0 for token in tokens @updateScopeStack(line, scopeStack, token.scopes) - hasIndentGuide = not mini and showIndentGuide and token.hasLeadingWhitespace or (token.hasTrailingWhitespace and lineIsWhitespaceOnly) + hasIndentGuide = not mini and showIndentGuide and (token.hasLeadingWhitespace or (token.hasTrailingWhitespace and lineIsWhitespaceOnly)) line.push(token.getValueAsHtml({invisibles, hasIndentGuide})) position += token.value.length