We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b8a052 commit aa7829aCopy full SHA for aa7829a
Sources/CodeEditSourceEditor/Find/ViewModel/FindPanelViewModel+Find.swift
@@ -54,14 +54,13 @@ extension FindPanelViewModel {
54
55
guard let regex = try? NSRegularExpression(pattern: pattern, options: findOptions) else {
56
self.findMatches = []
57
- self.currentFindMatchIndex = 0
+ self.currentFindMatchIndex = nil
58
return
59
}
60
61
let text = target.textView.string
62
- let nsText = text as NSString
63
- let range = NSRange(location: 0, length: nsText.length)
64
- let matches = regex.matches(in: text, range: range)
+ let range = target.textView.documentRange
+ let matches = regex.matches(in: text, range: range).filter { !$0.range.isEmpty }
65
66
self.findMatches = matches.map(\.range)
67
0 commit comments