mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Schedule redraw when updating an invisible editor
The redrawOnReattach flag will now be set when update display is called on an invisible editor so that if the editor is detached or hidden before the next update was processed it will be performed when reattached.
This commit is contained in:
@@ -2515,3 +2515,21 @@ describe "Editor", ->
|
||||
|
||||
runs ->
|
||||
expect(editor.renderedLines.find('.line').text()).toBe 'hidden changes'
|
||||
|
||||
it "redraws the editor when it is next reattached", ->
|
||||
editor.attachToDom()
|
||||
editor.hide()
|
||||
editor.setText('hidden changes')
|
||||
editor.setCursorBufferPosition([0,4])
|
||||
editor.detach()
|
||||
|
||||
displayUpdatedHandler = jasmine.createSpy("displayUpdatedHandler")
|
||||
editor.on 'editor:display-updated', displayUpdatedHandler
|
||||
editor.show()
|
||||
editor.attachToDom()
|
||||
|
||||
waitsFor ->
|
||||
displayUpdatedHandler.callCount is 1
|
||||
|
||||
runs ->
|
||||
expect(editor.renderedLines.find('.line').text()).toBe 'hidden changes'
|
||||
|
||||
@@ -783,7 +783,9 @@ class Editor extends View
|
||||
updateDisplay: (options={}) ->
|
||||
return unless @attached and @activeEditSession
|
||||
return if @activeEditSession.destroyed
|
||||
return unless @isVisible()
|
||||
unless @isVisible()
|
||||
@redrawOnReattach = true
|
||||
return
|
||||
|
||||
@updateRenderedLines()
|
||||
@highlightCursorLine()
|
||||
|
||||
Reference in New Issue
Block a user