mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Disable gutter background highlight on multiline selections
This commit is contained in:
@@ -1609,14 +1609,25 @@ describe "Editor", ->
|
||||
|
||||
it "highlights the line where the initial cursor position is", ->
|
||||
expect(editor.getCursorBufferPosition().row).toBe 0
|
||||
expect(editor.find('.line-number.cursor-line-number').length).toBe 1
|
||||
expect(editor.find('.line-number.cursor-line-number').text()).toBe "1"
|
||||
expect(editor.find('.line-number.cursor-line-number.cursor-line-number-background').length).toBe 1
|
||||
expect(editor.find('.line-number.cursor-line-number.cursor-line-number-background').text()).toBe "1"
|
||||
|
||||
it "updates the highlighted line when the cursor position changes", ->
|
||||
editor.setCursorBufferPosition([1,0])
|
||||
expect(editor.getCursorBufferPosition().row).toBe 1
|
||||
expect(editor.find('.line-number.cursor-line-number.cursor-line-number-background').length).toBe 1
|
||||
expect(editor.find('.line-number.cursor-line-number.cursor-line-number-background').text()).toBe "2"
|
||||
|
||||
describe "when the selection spans multiple lines", ->
|
||||
beforeEach ->
|
||||
editor.attachToDom(30)
|
||||
|
||||
it "doesn't highlight the backround", ->
|
||||
editor.getSelection().setBufferRange(new Range([0,0],[2,0]))
|
||||
expect(editor.getSelection().isMultiLine()).toBe true
|
||||
expect(editor.find('.line-number.cursor-line-number').length).toBe 1
|
||||
expect(editor.find('.line-number.cursor-line-number').text()).toBe "2"
|
||||
expect(editor.find('.line-number.cursor-line-number.cursor-line-number-background').length).toBe 0
|
||||
expect(editor.find('.line-number.cursor-line-number').text()).toBe "3"
|
||||
|
||||
describe "line highlighting", ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -60,5 +60,12 @@ class Gutter extends View
|
||||
highlightCursorLine: ->
|
||||
cursorScreenRow = @editor().getCursorScreenPosition().row
|
||||
screenRowIndex = cursorScreenRow - @firstScreenRow
|
||||
@find(".line-number.cursor-line-number").removeClass('cursor-line-number')
|
||||
@find(".line-number:eq(#{screenRowIndex})").addClass('cursor-line-number')
|
||||
|
||||
currentLineNumberRow = @find(".line-number.cursor-line-number")
|
||||
currentLineNumberRow.removeClass('cursor-line-number')
|
||||
currentLineNumberRow.removeClass('cursor-line-number-background')
|
||||
|
||||
newLineNumberRow = @find(".line-number:eq(#{screenRowIndex})")
|
||||
newLineNumberRow.addClass('cursor-line-number')
|
||||
if !@editor().getSelection().isMultiLine()
|
||||
newLineNumberRow.addClass('cursor-line-number-background')
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
color: rgba(255, 255, 255, .6);
|
||||
}
|
||||
|
||||
.line.cursor-line, .line-number.cursor-line-number {
|
||||
.line.cursor-line, .line-number.cursor-line-number-background {
|
||||
background-color: rgba(255, 255, 255, .12);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user