 
         @position = INVALID
       else
-        throw new Error "Unexpected position for side: #{@position}"
+        throw new Error("Unexpected position for side: #{@position}")
 
     bannerMarker = @editor.markBufferRange(
       [[bannerRowStart, 0], [bannerRowEnd, 0]], @options

    # @previousSide should always be populated because @position is MIDDLE.
    @previousSide.followingMarker = marker

    new Navigator marker

  markTheirs: -> @_markHunk TheirSide

  _markHunk: (sideKlass) ->
    sidePosition = @position
    switch @position

    @navigator.conflict = this
    @resolution = null

  # Public: Has this conflict been resolved in any way?
  #
  # Return [Boolean]
  #
  isResolved: -> @resolution?

  # Public: Attach an event handler to be notified when this conflict is resolved.
  #
  # callback [Function]
  #
  onDidResolveConflict: (callback) ->
    @emitter.on 'resolve-conflict', callback

  # Public: Specify which Side is to be kept. Note that either side may have been modified by the
  # user prior to resolution. Notify any subscribers.
  #
  # side [Side] our changes or their changes.
  #
  resolveAs: (side) ->
    @resolution = side
    @emitter.emit 'resolve-conflict'

  # Public: Locate the position that the editor should scroll to in order to make this conflict
  # visible.
  #
  # Return [Point] buffer coordinates
  #
  scrollTarget: -> @ours.marker.getTailBufferPosition()

  # Public: Audit all Marker instances owned by subobjects within this Conflict.
  #
  # Return [Array<Marker>]
  #
  markers: ->
    _.flatten [@ours.markers(), @theirs.markers(), @navigator.markers()], true

  # Public: Console-friendly identification of this conflict.
  #
  # Return [String] that distinguishes this conflict from others.
  #
  toString: -> "[conflict: #{@ours} #{@theirs}]"

  # Public: Parse any conflict markers in a TextEditor's buffer and return a Conflict that contains
  # markers corresponding to each.
  #
  # state [MergeState] Repository-wide state of the merge.
  # editor [TextEditor] The editor to search.
  # return [Array<Conflict>] A (possibly empty) collection of parsed Conflicts.
  #
  @all: (state, editor) ->
    results = []
    previous = null
    marker = new ConflictParser(state, editor)

    editor.getBuffer().scan CONFLICT_REGEX, (m) ->
      marker.start m
