mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add TextEditor::observeMarkers, use it in presenter
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Nathan Sobo
parent
b59bec5f9d
commit
6f553f234c
@@ -10,6 +10,7 @@ Model = require './model'
|
||||
Token = require './token'
|
||||
Decoration = require './decoration'
|
||||
Marker = require './marker'
|
||||
MarkerObservationWindow = require './marker-observation-window'
|
||||
|
||||
class BufferToScreenConversionError extends Error
|
||||
constructor: (@message, @metadata) ->
|
||||
@@ -950,6 +951,9 @@ class DisplayBuffer extends Model
|
||||
@emitter.emit 'did-remove-decoration', decoration
|
||||
delete @decorationsByMarkerId[marker.id] if decorations.length is 0
|
||||
|
||||
decorationsForMarkerId: (markerId) ->
|
||||
@decorationsByMarkerId[markerId]
|
||||
|
||||
# Retrieves a {Marker} based on its id.
|
||||
#
|
||||
# id - A {Number} representing a marker id
|
||||
@@ -1045,6 +1049,9 @@ class DisplayBuffer extends Model
|
||||
params = @translateToBufferMarkerParams(params)
|
||||
@buffer.findMarkers(params).map (stringMarker) => @getMarker(stringMarker.id)
|
||||
|
||||
observeMarkers: (callback) ->
|
||||
new MarkerObservationWindow(this, @buffer.observeMarkers(callback))
|
||||
|
||||
translateToBufferMarkerParams: (params) ->
|
||||
bufferMarkerParams = {}
|
||||
for key, value of params
|
||||
|
||||
Reference in New Issue
Block a user