From 855f955dec8dd12059a63f77dea2867484d7ecb9 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Fri, 3 May 2013 17:22:50 -0600 Subject: [PATCH] Make BufferMarker return copies of its points so they can't be mutated --- src/app/buffer-marker.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/buffer-marker.coffee b/src/app/buffer-marker.coffee index 9677d5b15..8063214e4 100644 --- a/src/app/buffer-marker.coffee +++ b/src/app/buffer-marker.coffee @@ -74,19 +74,19 @@ class BufferMarker # Returns a {Range}. getRange: -> if @tailPosition - new Range(@tailPosition, @headPosition) + new Range(@getTailPosition(), @getHeadPosition()) else - new Range(@headPosition, @headPosition) + new Range(@getHeadPosition(), @getHeadPosition()) # Public: Retrieves the position of the marker's head. # # Returns a {Point}. - getHeadPosition: -> @headPosition + getHeadPosition: -> @headPosition?.copy() # Public: Retrieves the position of the marker's tail. # # Returns a {Point}. - getTailPosition: -> @tailPosition ? @getHeadPosition() + getTailPosition: -> @tailPosition?.copy() ? @getHeadPosition() # Public: Sets the position of the marker's head. #