Don't highlight the current line unless the selection is empty

This commit is contained in:
Nathan Sobo
2012-11-07 12:11:33 -07:00
parent 72d25b405f
commit d44e116321
2 changed files with 5 additions and 1 deletions

View File

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

View File

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