mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Don't render cursor line decorations in mini editors
This commit is contained in:
committed by
Antonio Scandurra
parent
1427dbf540
commit
82feef9f68
@@ -251,6 +251,19 @@ describe('TextEditorComponent', () => {
|
||||
expect(component.refs.gutterContainer).toBeUndefined()
|
||||
expect(element.querySelector('gutter-container')).toBeNull()
|
||||
})
|
||||
|
||||
it('does not render line decorations for the cursor line', async () => {
|
||||
const {component, element, editor} = buildComponent({mini: true})
|
||||
expect(element.querySelector('.line').classList.contains('cursor-line')).toBe(false)
|
||||
|
||||
editor.update({mini: false})
|
||||
await component.getNextUpdatePromise()
|
||||
expect(element.querySelector('.line').classList.contains('cursor-line')).toBe(true)
|
||||
|
||||
editor.update({mini: true})
|
||||
await component.getNextUpdatePromise()
|
||||
expect(element.querySelector('.line').classList.contains('cursor-line')).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('focus', () => {
|
||||
|
||||
@@ -200,9 +200,7 @@ class TextEditor extends Model
|
||||
|
||||
@decorationManager = new DecorationManager(@displayLayer)
|
||||
@decorateMarkerLayer(@selectionsMarkerLayer, type: 'cursor')
|
||||
@decorateMarkerLayer(@selectionsMarkerLayer, type: 'line-number', class: 'cursor-line')
|
||||
@decorateMarkerLayer(@selectionsMarkerLayer, type: 'line-number', class: 'cursor-line-no-selection', onlyHead: true, onlyEmpty: true)
|
||||
@decorateMarkerLayer(@selectionsMarkerLayer, type: 'line', class: 'cursor-line', onlyEmpty: true)
|
||||
@decorateCursorLine() unless @isMini()
|
||||
|
||||
@decorateMarkerLayer(@displayLayer.foldsMarkerLayer, {type: 'line-number', class: 'folded'})
|
||||
|
||||
@@ -225,6 +223,13 @@ class TextEditor extends Model
|
||||
priority: 0
|
||||
visible: lineNumberGutterVisible
|
||||
|
||||
decorateCursorLine: ->
|
||||
@cursorLineDecorations = [
|
||||
@decorateMarkerLayer(@selectionsMarkerLayer, type: 'line', class: 'cursor-line', onlyEmpty: true),
|
||||
@decorateMarkerLayer(@selectionsMarkerLayer, type: 'line-number', class: 'cursor-line'),
|
||||
@decorateMarkerLayer(@selectionsMarkerLayer, type: 'line-number', class: 'cursor-line-no-selection', onlyHead: true, onlyEmpty: true)
|
||||
]
|
||||
|
||||
doBackgroundWork: (deadline) =>
|
||||
if @displayLayer.doBackgroundWork(deadline)
|
||||
@presenter?.updateVerticalDimensions()
|
||||
@@ -297,6 +302,11 @@ class TextEditor extends Model
|
||||
displayLayerParams.invisibles = @getInvisibles()
|
||||
displayLayerParams.softWrapColumn = @getSoftWrapColumn()
|
||||
displayLayerParams.showIndentGuides = @doesShowIndentGuide()
|
||||
if @mini
|
||||
decoration.destroy() for decoration in @cursorLineDecorations
|
||||
@cursorLineDecorations = null
|
||||
else
|
||||
@decorateCursorLine()
|
||||
|
||||
when 'placeholderText'
|
||||
if value isnt @placeholderText
|
||||
|
||||
Reference in New Issue
Block a user