mirror of
https://github.com/atom/atom.git
synced 2026-02-07 13:14:55 -05:00
Allow markers to be created with just a position
When a marker is created with just a position, it only gets a head position and has no tail position.
This commit is contained in:
@@ -271,17 +271,26 @@ class Buffer
|
||||
getMarkers: ->
|
||||
_.values(@validMarkers)
|
||||
|
||||
markRange: (range, options) ->
|
||||
marker = new BufferMarker(_.extend({
|
||||
markRange: (range, options={}) ->
|
||||
marker = new BufferMarker(_.defaults({
|
||||
id: @nextMarkerId++
|
||||
buffer: this
|
||||
range: range
|
||||
range
|
||||
}, options))
|
||||
@validMarkers[marker.id] = marker
|
||||
marker.id
|
||||
|
||||
markPosition: (position, options) ->
|
||||
@markRange([position, position], _.defaults({noTail: true}, options))
|
||||
|
||||
getMarkerPosition: (id) ->
|
||||
@validMarkers[id]?.getPosition()
|
||||
@getMarkerHeadPosition(id)
|
||||
|
||||
getMarkerHeadPosition: (id) ->
|
||||
@validMarkers[id]?.getHeadPosition()
|
||||
|
||||
getMarkerTailPosition: (id) ->
|
||||
@validMarkers[id]?.getTailPosition()
|
||||
|
||||
getMarkerRange: (id) ->
|
||||
@validMarkers[id]?.getRange()
|
||||
|
||||
Reference in New Issue
Block a user