File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
Sources/CodeEditSourceEditor/Find Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ extension FindViewController: FindPanelDelegate {
8181 self . matchCase = matchCase
8282 if !findText. isEmpty {
8383 performFind ( )
84+ addEmphases ( )
8485 }
8586 }
8687
@@ -132,7 +133,7 @@ extension FindViewController: FindPanelDelegate {
132133 return
133134 }
134135
135- // Update to previous match∂
136+ // Update to previous match
136137 currentFindMatchIndex = ( currentFindMatchIndex - 1 + findMatches. count) % findMatches. count
137138
138139 // If the text view has focus, show a flash animation for the current match
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ extension FindViewController {
3232 return
3333 }
3434
35- let findOptions : NSRegularExpression . Options = smartCase ( str: findText) ? [ ] : [ . caseInsensitive]
35+ // Set case sensitivity based on matchCase property
36+ let findOptions : NSRegularExpression . Options = matchCase ? [ ] : [ . caseInsensitive]
3637 let escapedQuery = NSRegularExpression . escapedPattern ( for: findText)
3738
3839 guard let regex = try ? NSRegularExpression ( pattern: escapedQuery, options: findOptions) else {
@@ -52,7 +53,7 @@ extension FindViewController {
5253 currentFindMatchIndex = getNearestEmphasisIndex ( matchRanges: findMatches) ?? 0
5354 }
5455
55- private func addEmphases( ) {
56+ func addEmphases( ) {
5657 guard let target = target,
5758 let emphasisManager = target. emphasisManager else { return }
5859
@@ -116,10 +117,4 @@ extension FindViewController {
116117
117118 // Only re-find the part of the file that changed upwards
118119 private func reFind( ) { }
119-
120- // Returns true if string contains uppercase letter
121- // used for: ignores letter case if the find text is all lowercase
122- private func smartCase( str: String ) -> Bool {
123- return str. range ( of: " [A-Z] " , options: . regularExpression) != nil
124- }
125120}
You can’t perform that action at this time.
0 commit comments