Add ability to copy display buffer markers

This commit is contained in:
Nathan Sobo
2013-07-18 10:25:03 -07:00
parent c54bb792b2
commit 8b53b4d749
3 changed files with 26 additions and 1 deletions

View File

@@ -27,6 +27,9 @@ class DisplayBufferMarker
### Public ###
copy: (attributes) ->
@displayBuffer.getMarker(@bufferMarker.copy(attributes).id)
# Gets the screen range of the display marker.
#
# Returns a {Range}.
@@ -119,6 +122,9 @@ class DisplayBufferMarker
clearTail: ->
@bufferMarker.clearTail()
hasTail: ->
@bufferMarker.hasTail()
# Returns whether the head precedes the tail in the buffer
isReversed: ->
@bufferMarker.isReversed()
@@ -146,6 +152,13 @@ class DisplayBufferMarker
@bufferMarker.destroy()
@unsubscribe()
isEqual: (other) ->
return false unless other instanceof @constructor
@getBufferRange().isEqual(other.getBufferRange()) and
@isReversed() is other.isReversed() and
@hasTail() is other.hasTail() and
_.isEqual(@getAttributes(), other.getAttributes())
# Returns a {String} representation of the marker
inspect: ->
"DisplayBufferMarker(id: #{@id}, bufferRange: #{@getBufferRange().inspect()})"