 
 
 
+// MARK: -
+
+private class LineCounter: LineRangeCacheable {
+    
+    let string: String
+    var lineStartIndexes = IndexSet()
+    var firstLineUncoundedIndex = 0
+    
+    
+    init(_ string: String) {
+        
+        self.string = string
+    }
+    
+}
+
+
+
 // MARK: - UserDefaults
 
 private extension UserDefaults {

                    let matchedRange = matches[0]
                    
                    // calculate line number
                    let lastLineNumber = results.last?.lineNumber ?? 1
                    let lastLocation = results.last?.range.location ?? 0
                    let diffRange = NSRange(lastLocation..<matchedRange.location)
                    let lineNumber = lastLineNumber + lineRegex.numberOfMatches(in: textFind.string, range: diffRange)
                    
                    // build a highlighted line string for result table
                    let lineRange = (textFind.string as NSString).lineRange(for: matchedRange)

        textView.isEditable = false
        
        let highlightColors = NSColor.textHighlighterColors(count: textFind.numberOfCaptureGroups + 1)
        let lineCounter = LineCounter(textFind.string)
        
        // setup progress sheet
        let progress = TextFindProgress(format: .find)
