           @endBufferPosition = decorationIteratorPosition
           @endScreenPosition = @patchIterator.translateInputPosition(@endBufferPosition)
           @text = @text.substring(0, @endScreenPosition.column - @startScreenPosition.column)
-
-      if @openTags?
-        @containingTags.push(@openTags...)

        @endScreenPosition = @patchIterator.translateInputPosition(@endBufferPosition)

    if @decorationIterator?
      if @closeTags?
        for tag in @closeTags
          @containingTags.splice(@containingTags.lastIndexOf(tag), 1)

      if @isFold()
        @closeTags = (@closeTags ? []).concat(@containingTags)
        @containingTags.length = 0
        @openTags = null
        @tagsToReopen = @decorationIterator.seek(@getEndBufferPosition())

    @containingTags

  moveToSuccessor: ->
    if @closeTags?
      for tag in @closeTags
        @containingTags.splice(@containingTags.lastIndexOf(tag), 1)

    if @openTags?
      @containingTags.push(@openTags...)

    @startScreenPosition = @endScreenPosition
    @startBufferPosition = @endBufferPosition
    @closeTags = null
