         let newStrings = items.map { $0.string }
         let replacementRanges = items.map { NSRange($0.location..<$0.location) }
         let selectedRanges = (self.rangesForUserTextChange ?? self.selectedRanges)
-            .map { $0.rangeValue.move(inserting: items) }
+            .map { $0.rangeValue.inserted(items: items) }
         
         self.replace(with: newStrings, ranges: replacementRanges, selectedRanges: selectedRanges,
                      actionName: "Comment Out".localized)


private extension NSRange {
    
    /// Return a new range by assuming the indices of the given items are inserted.
    ///
    /// - Parameter items: An array of items to be inserted.
    /// - Returns: A new range that the receiver moved.
    func move(inserting items: [(string: String, location: Int, forward: Bool)]) -> NSRange {
        
        var location = items
            .prefix { $0.location < self.lowerBound }  //  || ($0.location == self.lowerBound && $0.forward)

        
        let spacer = self.appendsCommentSpacer ? " " : ""
        let targetRanges = self.commentingRanges(fromLineHead: fromLineHead)
        let items: [NSRange.InsertionItem] = {
            if let delimiter = self.inlineCommentDelimiter, types.contains(.inline) {
                return self.string.inlineCommentOut(delimiter: delimiter, spacer: spacer, ranges: targetRanges)
            }
