         self.applyResult(message: nil, textField: self.findResultField!, textView: self.findTextView!)
         
         // -> specify the object to remove osberver to avoid removing the windowWillClose notification (via delegate) from find panel itself.
-        if let target = self.currentResultMessageTarget?.firstTextView {
-            NotificationCenter.default.removeObserver(self, name: NSTextStorage.didProcessEditingNotification, object: target.textStorage)
-            NotificationCenter.default.removeObserver(self, name: NSWindow.willCloseNotification, object: target.window)
-        }
+        self.removeCurrentTargetObservers()
     }
     
     

        self.applyResult(message: message, textField: self.findResultField!, textView: self.findTextView!)
        
        // dismiss result either client text or find string did change
        self.currentResultMessageTarget = target.layoutManager
        NotificationCenter.default.addObserver(self, selector: #selector(clearNumberOfFound), name: NSTextStorage.didProcessEditingNotification, object: target.textStorage)
        NotificationCenter.default.addObserver(self, selector: #selector(clearNumberOfFound), name: NSWindow.willCloseNotification, object: target.window)

        textView.enclosingScrollView?.contentView.contentInsets.right = textField.frame.width
    }
    
    
    /// remove observers for result message clear
    private func removeCurrentTargetObservers() {
        
        guard let target = self.currentResultMessageTarget?.firstTextView else { return }
        
        NotificationCenter.default.removeObserver(self, name: NSTextStorage.didProcessEditingNotification, object: target.textStorage)
        NotificationCenter.default.removeObserver(self, name: NSWindow.willCloseNotification, object: target.window)
        
        self.currentResultMessageTarget = nil
    }
    
}
