mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-07 07:40:40 +03:00
Mark text editors as being registered.
This commit is contained in:
parent
b7c6850413
commit
9adc822822
@ -26,8 +26,20 @@ class TextEditorRegistry
|
||||
# editor is destroyed.
|
||||
add: (editor) ->
|
||||
@editors.add(editor)
|
||||
editor.registered = true
|
||||
|
||||
@emitter.emit 'did-add-editor', editor
|
||||
new Disposable => @editors.delete(editor)
|
||||
new Disposable => @remove(editor)
|
||||
|
||||
# Remove a `TextEditor`.
|
||||
#
|
||||
# * `editor` The editor to remove.
|
||||
#
|
||||
# Returns a {Boolean} indicating whether the editor was successfully removed.
|
||||
remove: (editor) ->
|
||||
removed = @editors.delete(editor)
|
||||
editor.registered = false
|
||||
removed
|
||||
|
||||
# Invoke the given callback with all the current and future registered
|
||||
# `TextEditors`.
|
||||
|
@ -62,6 +62,7 @@ class TextEditor extends Model
|
||||
selectionFlashDuration: 500
|
||||
gutterContainer: null
|
||||
editorElement: null
|
||||
registered: false
|
||||
|
||||
Object.defineProperty @prototype, "element",
|
||||
get: -> @getElement()
|
||||
@ -157,7 +158,7 @@ class TextEditor extends Model
|
||||
firstVisibleScreenColumn: @getFirstVisibleScreenColumn()
|
||||
displayBuffer: @displayBuffer.serialize()
|
||||
selectionsMarkerLayerId: @selectionsMarkerLayer.id
|
||||
registered: atom.textEditors.editors.has this
|
||||
registered: @registered
|
||||
|
||||
subscribeToBuffer: ->
|
||||
@buffer.retain()
|
||||
|
Loading…
Reference in New Issue
Block a user