mirror of
https://github.com/atom/atom.git
synced 2026-02-17 10:01:25 -05:00
Add Buffer.findMarker[s], which returns marker[s] matching attributes
This commit is contained in:
@@ -13,7 +13,7 @@ class BufferMarker
|
||||
###
|
||||
# Internal #
|
||||
###
|
||||
constructor: ({@id, @buffer, range, @invalidationStrategy, noTail, reverse}) ->
|
||||
constructor: ({@id, @buffer, range, @invalidationStrategy, @attributes, noTail, reverse}) ->
|
||||
@invalidationStrategy ?= 'contains'
|
||||
@setRange(range, {noTail, reverse})
|
||||
|
||||
@@ -45,6 +45,14 @@ class BufferMarker
|
||||
isReversed: ->
|
||||
@tailPosition? and @headPosition.isLessThan(@tailPosition)
|
||||
|
||||
# Checks that the marker's attributes match the given attributes
|
||||
#
|
||||
# Returns a {Boolean}.
|
||||
matchesAttributes: (queryAttributes) ->
|
||||
for key, value of queryAttributes
|
||||
return false unless _.isEqual(@attributes[key], value)
|
||||
true
|
||||
|
||||
# Public: Identifies if the marker's head position is equal to its tail.
|
||||
#
|
||||
# Returns a {Boolean}.
|
||||
|
||||
Reference in New Issue
Block a user