From cef8b95ef3cb53c96894eb2181f52744521e7bca Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Wed, 17 Sep 2014 17:57:37 -0700 Subject: [PATCH] Deprecate s|getAttributes for s|getProperties --- spec/display-buffer-spec.coffee | 4 ++-- src/display-buffer-marker.coffee | 12 +++++++++--- src/editor.coffee | 6 +++--- src/selection.coffee | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 9f00eff3a..e3451e575 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -1020,8 +1020,8 @@ describe "DisplayBuffer", -> marker2 = marker1.copy(b: 3) expect(marker2.getBufferRange()).toEqual marker1.getBufferRange() expect(displayBuffer.getMarkerCount()).toBe initialMarkerCount + 2 - expect(marker1.getAttributes()).toEqual a: 1, b: 2 - expect(marker2.getAttributes()).toEqual a: 1, b: 3 + expect(marker1.getProperties()).toEqual a: 1, b: 2 + expect(marker2.getProperties()).toEqual a: 1, b: 3 describe "DisplayBufferMarker::getPixelRange()", -> it "returns the start and end positions of the marker based on the line height and character widths assigned to the DisplayBuffer", -> diff --git a/src/display-buffer-marker.coffee b/src/display-buffer-marker.coffee index e7e03e407..0e001dc65 100644 --- a/src/display-buffer-marker.coffee +++ b/src/display-buffer-marker.coffee @@ -139,15 +139,21 @@ class DisplayBufferMarker # Extended: Returns an {Object} containing any custom properties associated with # the marker. - getAttributes: -> + getProperties: -> @bufferMarker.getProperties() + getAttributes: -> + deprecate 'Use Marker::getProperties instead' + @getProperties() # Extended: Merges an {Object} containing new properties into the marker's # existing properties. # # * `properties` {Object} - setAttributes: (attributes) -> - @bufferMarker.setProperties(attributes) + setProperties: (properties) -> + @bufferMarker.setProperties(properties) + setAttributes: (properties) -> + deprecate 'Use Marker::getProperties instead' + @setProperties(properties) matchesAttributes: (attributes) -> attributes = @displayBuffer.translateToBufferMarkerParams(attributes) diff --git a/src/editor.coffee b/src/editor.coffee index f63dfc0b5..b7b918ae0 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -93,7 +93,7 @@ class Editor extends Model @softTabs = @usesSoftTabs() ? @softTabs ? atom.config.get('editor.softTabs') ? true for marker in @findMarkers(@getSelectionMarkerAttributes()) - marker.setAttributes(preserveFolds: true) + marker.setProperties(preserveFolds: true) @addSelection(marker) @subscribeToBuffer() @@ -2480,13 +2480,13 @@ class Editor extends Model # # Returns the new {Selection}. addSelection: (marker, options={}) -> - unless marker.getAttributes().preserveFolds + unless marker.getProperties().preserveFolds @destroyFoldsIntersectingBufferRange(marker.getBufferRange()) cursor = @addCursor(marker) selection = new Selection(_.extend({editor: this, marker, cursor}, options)) @selections.push(selection) selectionBufferRange = selection.getBufferRange() - @mergeIntersectingSelections(preserveFolds: marker.getAttributes().preserveFolds) + @mergeIntersectingSelections(preserveFolds: marker.getProperties().preserveFolds) if selection.destroyed for selection in @getSelections() if selection.intersectsBufferRange(selectionBufferRange) diff --git a/src/selection.coffee b/src/selection.coffee index a220a49b6..42fb54cae 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -176,7 +176,7 @@ class Selection extends Model # Public: Clears the selection, moving the marker to the head. clear: -> - @marker.setAttributes(goalBufferRange: null) + @marker.setProperties(goalBufferRange: null) @marker.clearTail() unless @retainSelection @finalize() @@ -717,5 +717,5 @@ class Selection extends Model @marker.plantTail() getGoalBufferRange: -> - if goalBufferRange = @marker.getAttributes().goalBufferRange + if goalBufferRange = @marker.getProperties().goalBufferRange Range.fromObject(goalBufferRange)