         self.viewControllerForSheet?.presentAsSheet(self.customSurroundStringViewController)
     }
     
+}
+
+
+
+extension NSTextView {
     
+    /// instantinate a new CustomSurroundStringViewController for the receiver
     func instantinateSurroundStringViewController() -> NSViewController {
         
         let viewController = CustomSurroundStringViewController.instantiate(storyboard: "CustomSurroundStringView")

        
        guard self.replace(with: replacementStrings, ranges: selectedRanges, selectedRanges: newSelectedRanges) else { return false }
        
        UserDefaults.standard[.beginCustomSurroundString] = begin
        UserDefaults.standard[.endCustomSurroundString] = end
        

        return viewController
    }
    
    
    /// insert strings around selections
    @discardableResult
