Skip to content

Commit fb2c670

Browse files
committed
Add documentation
1 parent deebe23 commit fb2c670

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/CodeEditSourceEditor/Find/FindViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ extension FindViewController: FindPanelDelegate {
290290
}
291291

292292
func searchFile(query: String) {
293-
// Don't search if target or emphasizeAPI isn't ready
294293
guard let target = target,
295294
let emphasizeAPI = target.emphasizeAPI else {
296295
findPanel.searchDelegate?.findPanelUpdateMatchCount(0)
@@ -336,6 +335,10 @@ extension FindViewController: FindPanelDelegate {
336335
}
337336
}
338337

338+
/// Finds the index of the nearest emphasised match range relative to the cursor or visible text range.
339+
///
340+
/// - Parameter matchRanges: An array of `NSRange` representing the emphasised match locations.
341+
/// - Returns: The index of the nearest match in `matchRanges`, or `nil` if no matches are found.
339342
private func getNearestHighlightIndex(matchRanges: borrowing [NSRange]) -> Int? {
340343
guard !matchRanges.isEmpty,
341344
let textViewController = target as? TextViewController,

0 commit comments

Comments
 (0)