                 
             case .autoLinkDetection:
                 self.isAutomaticLinkDetectionEnabled = new as! Bool
-                if self.isAutomaticLinkDetectionEnabled {
-                    self.detectLinkIfNeeded()
-                } else if let textStorage = self.textStorage {
-                    textStorage.removeAttribute(.link, range: textStorage.range)
+                if let textStorage = self.textStorage {
+                    if self.isAutomaticLinkDetectionEnabled {
+                        textStorage.detectLink()
+                    } else {
+                        textStorage.removeAttribute(.link, range: textStorage.range)
+                    }
                 }
                 
             case .pageGuideColumn:

    /// read pasted/dropped item from NSPaseboard (involed in `performDragOperation(_:)`)
    override func readSelection(from pboard: NSPasteboard, type: NSPasteboard.PasteboardType) -> Bool {
        
        // apply link to pasted string
        defer {
            self.detectLinkIfNeeded()
        }
        
        // on file drop

        
        self.textContainerInset.height = height
        self.sizeToFit()
    }
    
    
