mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
[Gutter][DOM Persistence] Clear the decorations of a gutter node if it is not visible
This commit is contained in:
@@ -392,6 +392,7 @@ class TextEditorPresenter
|
||||
gutterDisposables = new CompositeDisposable
|
||||
gutterDisposables.add gutter.onDidChangeVisible =>
|
||||
@updateCustomGutterState()
|
||||
@updateCustomGutterDecorationState()
|
||||
gutterDisposables.add gutter.onDidDestroy =>
|
||||
@disposables.remove(gutterDisposables)
|
||||
gutterDisposables.dispose()
|
||||
@@ -409,9 +410,7 @@ class TextEditorPresenter
|
||||
if @model.isMini()
|
||||
return
|
||||
for gutter in @model.getGutters()
|
||||
isVisible = gutter.isVisible()
|
||||
if gutter.name is 'line-number'
|
||||
isVisible = isVisible && @showLineNumbers
|
||||
isVisible = @gutterIsVisible(gutter)
|
||||
@state.gutters.sortedDescriptions.push({gutter, visible: isVisible})
|
||||
|
||||
# Updates the decoration state for the gutter with the given gutterName.
|
||||
@@ -434,6 +433,8 @@ class TextEditorPresenter
|
||||
@state.gutters.customDecorations[gutterName] = {}
|
||||
gutterState = @state.gutters.customDecorations[gutterName]
|
||||
|
||||
return if !@gutterIsVisible(gutter)
|
||||
|
||||
relevantDecorations = @customGutterDecorationsInRange(gutterName, @startRow, @endRow - 1)
|
||||
return if !relevantDecorations
|
||||
|
||||
@@ -445,6 +446,12 @@ class TextEditorPresenter
|
||||
item: decoration.getProperties().item
|
||||
class: decoration.getProperties().class
|
||||
|
||||
gutterIsVisible: (gutterModel) ->
|
||||
isVisible = gutterModel.isVisible()
|
||||
if gutterModel.name is 'line-number'
|
||||
isVisible = isVisible && @showLineNumbers
|
||||
isVisible
|
||||
|
||||
updateLineNumbersState: -> @batch "shouldUpdateLineNumbersState", ->
|
||||
return unless @startRow? and @endRow? and @lineHeight?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user