mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Give selection view '.selection' class and region divs '.region' class
This commit is contained in:
@@ -270,11 +270,11 @@ describe "Editor", ->
|
||||
expect(editor.verticalScrollbar.prop('scrollHeight')).toBe previousScrollHeight
|
||||
expect(editor.scrollTop()).toBe 750
|
||||
expect(editor.getSelection().getScreenRange()).toEqual [[40, 0], [43, 1]]
|
||||
expect(editor.getSelectionView().find('.selection')).toExist()
|
||||
expect(editor.getSelectionView().find('.region')).toExist()
|
||||
|
||||
editor.setActiveEditSessionIndex(0)
|
||||
editor.activeEditSession.selectToEndOfLine()
|
||||
expect(editor.getSelectionView().find('.selection')).toExist()
|
||||
expect(editor.getSelectionView().find('.region')).toExist()
|
||||
|
||||
it "triggers alert if edit session's buffer goes into conflict with changes on disk", ->
|
||||
path = "/tmp/atom-changed-file.txt"
|
||||
@@ -539,7 +539,7 @@ describe "Editor", ->
|
||||
editor.setSelectedBufferRange([[5, 2], [5, 7]])
|
||||
|
||||
rootView.setFontSize(30)
|
||||
selectionRegion = editor.find('.selection')
|
||||
selectionRegion = editor.find('.region')
|
||||
expect(selectionRegion.position().top).toBe 5 * editor.lineHeight
|
||||
expect(selectionRegion.position().left).toBe 2 * editor.charWidth
|
||||
expect(selectionRegion.height()).toBe editor.lineHeight
|
||||
@@ -907,11 +907,11 @@ describe "Editor", ->
|
||||
it "clears previously drawn regions before creating new ones", ->
|
||||
selection.setBufferRange(new Range({row: 2, column: 7}, {row: 4, column: 25}))
|
||||
expect(selectionView.regions.length).toBe 3
|
||||
expect(selectionView.find('.selection').length).toBe 3
|
||||
expect(selectionView.find('.region').length).toBe 3
|
||||
|
||||
selectionView.updateDisplay()
|
||||
expect(selectionView.regions.length).toBe 3
|
||||
expect(selectionView.find('.selection').length).toBe 3
|
||||
expect(selectionView.find('.region').length).toBe 3
|
||||
|
||||
describe "when a selection merges with another selection", ->
|
||||
it "removes the merged selection view", ->
|
||||
@@ -922,7 +922,7 @@ describe "Editor", ->
|
||||
editSession.selectToScreenPosition([6, 27])
|
||||
|
||||
expect(editor.getSelectionViews().length).toBe 1
|
||||
expect(editor.find('.selection').length).toBe 3
|
||||
expect(editor.find('.region').length).toBe 3
|
||||
|
||||
describe "when the selection is created with the selectAll event", ->
|
||||
it "does not scroll to the end of the buffer", ->
|
||||
|
||||
@@ -44,7 +44,7 @@ describe "TextMateTheme", ->
|
||||
'border-color': '#A7A7A7'
|
||||
|
||||
expect(rulesets[2]).toEqual
|
||||
selector: '.editor.focused .selection'
|
||||
selector: '.editor.focused .selection .region'
|
||||
properties:
|
||||
'background-color': "rgba(221, 240, 255, 0.2)"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Range = require 'range'
|
||||
module.exports =
|
||||
class SelectionView extends View
|
||||
@content: ->
|
||||
@div()
|
||||
@div class: 'selection'
|
||||
|
||||
regions: null
|
||||
destroyed: false
|
||||
@@ -45,7 +45,7 @@ class SelectionView extends View
|
||||
else
|
||||
css.right = 0
|
||||
|
||||
region = ($$ -> @div class: 'selection').css(css)
|
||||
region = ($$ -> @div class: 'region').css(css)
|
||||
@append(region)
|
||||
@regions.push(region)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class TextMateTheme
|
||||
'border-color': @translateColor(caret)
|
||||
|
||||
@rulesets.push
|
||||
selector: '.editor.focused .selection'
|
||||
selector: '.editor.focused .selection .region'
|
||||
properties:
|
||||
'background-color': @translateColor(selection)
|
||||
|
||||
|
||||
@@ -116,19 +116,18 @@
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.editor .selection {
|
||||
.editor .selection .region {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
|
||||
@-webkit-keyframes highlight {
|
||||
from { background-color: rgba(100, 255, 100, 0.7); }
|
||||
to { background-color: null; }
|
||||
}
|
||||
|
||||
.editor .highlighted .selection {
|
||||
.editor .highlighted.selection .region {
|
||||
-webkit-animation-name: highlight;
|
||||
-webkit-animation-duration: 1s;
|
||||
-webkit-animation-iteration-count: 1;
|
||||
|
||||
Reference in New Issue
Block a user