Add fold- prefix to selected class name

This prevents interference with the base selected class
which adds a noticeable blur to folded lines that are selected
when using dark syntax and light ui.
This commit is contained in:
Kevin Sawicki
2013-11-06 09:47:01 -08:00
parent 5033fac8eb
commit 90c21906a4
2 changed files with 9 additions and 8 deletions

View File

@@ -2133,16 +2133,16 @@ describe "Editor", ->
expect(editor.find('.cursor')).toBeVisible()
describe "when a selected fold is scrolled into view (and the fold line was not previously rendered)", ->
it "renders the fold's line element with the 'selected' class", ->
it "renders the fold's line element with the 'fold-selected' class", ->
setEditorHeightInLines(editor, 5)
editor.resetDisplay()
editor.createFold(2, 4)
editor.setSelectedBufferRange([[1, 0], [5, 0]], preserveFolds: true)
expect(editor.renderedLines.find('.fold.selected')).toExist()
expect(editor.renderedLines.find('.fold.fold-selected')).toExist()
editor.scrollToBottom()
expect(editor.renderedLines.find('.fold.selected')).not.toExist()
expect(editor.renderedLines.find('.fold.fold-selected')).not.toExist()
editor.scrollTop(0)
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected')

View File

@@ -929,11 +929,12 @@ class Editor extends View
@scrollVertically(pixelPosition, options)
@scrollHorizontally(pixelPosition)
# Given a buffer range, this highlights all the folds within that range
# Highlight all the folds within the given buffer range.
#
# "Highlighting" essentially just adds the `selected` class to the line
# "Highlighting" essentially just adds the `fold-selected` class to the line's
# DOM element.
#
# bufferRange - The {Range} to check
# bufferRange - The {Range} to check.
highlightFoldsContainingBufferRange: (bufferRange) ->
screenLines = @linesForScreenRows(@firstRenderedScreenRow, @lastRenderedScreenRow)
for screenLine, i in screenLines
@@ -942,9 +943,9 @@ class Editor extends View
element = @lineElementForScreenRow(screenRow)
if bufferRange.intersectsWith(fold.getBufferRange())
element.addClass('selected')
element.addClass('fold-selected')
else
element.removeClass('selected')
element.removeClass('fold-selected')
saveScrollPositionForActiveEditSession: ->
if @attached