From d44e11632188c29c83f5aea5625cf78fd3bbd627 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 7 Nov 2012 12:11:33 -0700 Subject: [PATCH] Don't highlight the current line unless the selection is empty --- spec/app/editor-spec.coffee | 4 ++++ src/app/editor.coffee | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 27479364b..32cc668d0 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -1725,6 +1725,10 @@ describe "Editor", -> expect(editor.find('.line.cursor-line').length).toBe 1 expect(editor.find('.line.cursor-line').text()).toBe buffer.lineForRow(1) + it "does not highlight the line if the selection is not empty", -> + editor.setSelectedBufferRange([[1, 0], [1, 1]]) + expect(editor.find('.line.cursor-line').length).toBe 0 + it "when a newline is deleted with backspace, the line of the new cursor position is highlighted", -> editor.setCursorScreenPosition([1,0]) editor.backspace() diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 584cd1d73..e571d6d48 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -971,7 +971,7 @@ class Editor extends View return if @mini @highlightedLine?.removeClass('cursor-line') - if @getSelection().isSingleScreenLine() + if @getSelection().isEmpty() @highlightedLine = @lineElementForScreenRow(@getCursorScreenRow()) @highlightedLine.addClass('cursor-line') else