mirror of
https://github.com/atom/atom.git
synced 2026-02-07 13:14:55 -05:00
Rename Marker to TextEditorMarker to resolve ambiguity w/ TextBuffer API
We expose both kinds of markers in Atom, and the docs were actually wrong when we refer to Markers from TextBuffer because it linked to the TextEditor layer’s Marker implementation. This will clarify the difference.
This commit is contained in:
@@ -8,7 +8,7 @@ Model = require './model'
|
||||
Token = require './token'
|
||||
Decoration = require './decoration'
|
||||
LayerDecoration = require './layer-decoration'
|
||||
Marker = require './marker'
|
||||
TextEditorMarker = require './text-editor-marker'
|
||||
|
||||
class BufferToScreenConversionError extends Error
|
||||
constructor: (@message, @metadata) ->
|
||||
@@ -826,21 +826,21 @@ class DisplayBuffer extends Model
|
||||
decorationsForMarkerId: (markerId) ->
|
||||
@decorationsByMarkerId[markerId]
|
||||
|
||||
# Retrieves a {Marker} based on its id.
|
||||
# Retrieves a {TextEditorMarker} based on its id.
|
||||
#
|
||||
# id - A {Number} representing a marker id
|
||||
#
|
||||
# Returns the {Marker} (if it exists).
|
||||
# Returns the {TextEditorMarker} (if it exists).
|
||||
getMarker: (id) ->
|
||||
unless marker = @markers[id]
|
||||
if bufferMarker = @buffer.getMarker(id)
|
||||
marker = new Marker({bufferMarker, displayBuffer: this})
|
||||
marker = new TextEditorMarker({bufferMarker, displayBuffer: this})
|
||||
@markers[id] = marker
|
||||
marker
|
||||
|
||||
# Retrieves the active markers in the buffer.
|
||||
#
|
||||
# Returns an {Array} of existing {Marker}s.
|
||||
# Returns an {Array} of existing {TextEditorMarker}s.
|
||||
getMarkers: ->
|
||||
@buffer.getMarkers().map ({id}) => @getMarker(id)
|
||||
|
||||
@@ -850,7 +850,7 @@ class DisplayBuffer extends Model
|
||||
# Public: Constructs a new marker at the given screen range.
|
||||
#
|
||||
# range - The marker {Range} (representing the distance between the head and tail)
|
||||
# options - Options to pass to the {Marker} constructor
|
||||
# options - Options to pass to the {TextEditorMarker} constructor
|
||||
#
|
||||
# Returns a {Number} representing the new marker's ID.
|
||||
markScreenRange: (args...) ->
|
||||
@@ -860,7 +860,7 @@ class DisplayBuffer extends Model
|
||||
# Public: Constructs a new marker at the given buffer range.
|
||||
#
|
||||
# range - The marker {Range} (representing the distance between the head and tail)
|
||||
# options - Options to pass to the {Marker} constructor
|
||||
# options - Options to pass to the {TextEditorMarker} constructor
|
||||
#
|
||||
# Returns a {Number} representing the new marker's ID.
|
||||
markBufferRange: (range, options) ->
|
||||
@@ -869,7 +869,7 @@ class DisplayBuffer extends Model
|
||||
# Public: Constructs a new marker at the given screen position.
|
||||
#
|
||||
# range - The marker {Range} (representing the distance between the head and tail)
|
||||
# options - Options to pass to the {Marker} constructor
|
||||
# options - Options to pass to the {TextEditorMarker} constructor
|
||||
#
|
||||
# Returns a {Number} representing the new marker's ID.
|
||||
markScreenPosition: (screenPosition, options) ->
|
||||
@@ -878,7 +878,7 @@ class DisplayBuffer extends Model
|
||||
# Public: Constructs a new marker at the given buffer position.
|
||||
#
|
||||
# range - The marker {Range} (representing the distance between the head and tail)
|
||||
# options - Options to pass to the {Marker} constructor
|
||||
# options - Options to pass to the {TextEditorMarker} constructor
|
||||
#
|
||||
# Returns a {Number} representing the new marker's ID.
|
||||
markBufferPosition: (bufferPosition, options) ->
|
||||
@@ -895,7 +895,7 @@ class DisplayBuffer extends Model
|
||||
#
|
||||
# Refer to {DisplayBuffer::findMarkers} for details.
|
||||
#
|
||||
# Returns a {Marker} or null
|
||||
# Returns a {TextEditorMarker} or null
|
||||
findMarker: (params) ->
|
||||
@findMarkers(params)[0]
|
||||
|
||||
@@ -916,7 +916,7 @@ class DisplayBuffer extends Model
|
||||
# :containedInBufferRange - A {Range} or range-compatible {Array}. Only
|
||||
# returns markers contained within this range.
|
||||
#
|
||||
# Returns an {Array} of {Marker}s
|
||||
# Returns an {Array} of {TextEditorMarker}s
|
||||
findMarkers: (params) ->
|
||||
params = @translateToBufferMarkerParams(params)
|
||||
@buffer.findMarkers(params).map (stringMarker) => @getMarker(stringMarker.id)
|
||||
|
||||
Reference in New Issue
Block a user