Repository navigation
Select find text on repeated Cmd+F #3314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5031,18 +5031,18 @@ extension BrowserPanel { | |
| "firstResponder=\(String(describing: window?.firstResponder))" | ||
| ) | ||
| #endif | ||
| postBrowserSearchFocusNotification(reason: "immediate", generation: generation) | ||
| postBrowserSearchFocusNotification(reason: "immediate", generation: generation, selectAll: !created) | ||
| // Focus notification can race with portal overlay mount. Re-post on the | ||
| // next runloop and shortly after so the find field can claim first responder. | ||
| DispatchQueue.main.async { [weak self] in | ||
| self?.postBrowserSearchFocusNotification(reason: "async0", generation: generation) | ||
| self?.postBrowserSearchFocusNotification(reason: "async0", generation: generation, selectAll: !created) | ||
| } | ||
| DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in | ||
| self?.postBrowserSearchFocusNotification(reason: "async50ms", generation: generation) | ||
| self?.postBrowserSearchFocusNotification(reason: "async50ms", generation: generation, selectAll: false) | ||
|
Comment on lines
5040
to
+5041
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Useful? React with 👍 / 👎. |
||
| } | ||
| } | ||
|
|
||
| private func postBrowserSearchFocusNotification(reason: String, generation: UInt64) { | ||
| private func postBrowserSearchFocusNotification(reason: String, generation: UInt64, selectAll: Bool) { | ||
| guard canApplySearchFocusRequest(generation) else { | ||
| #if DEBUG | ||
| cmuxDebugLog( | ||
|
|
@@ -5057,11 +5057,11 @@ extension BrowserPanel { | |
| cmuxDebugLog( | ||
| "browser.find.focusNotification panel=\(id.uuidString.prefix(5)) " + | ||
| "generation=\(generation) " + | ||
| "reason=\(reason) window=\(window?.windowNumber ?? -1) " + | ||
| "reason=\(reason) selectAll=\(selectAll ? 1 : 0) window=\(window?.windowNumber ?? -1) " + | ||
| "firstResponder=\(String(describing: window?.firstResponder))" | ||
| ) | ||
| #endif | ||
| NotificationCenter.default.post(name: .browserSearchFocus, object: id) | ||
| NotificationCenter.default.post(name: .browserSearchFocus, object: id, userInfo: [FindFocusNotificationKey.selectAll: selectAll]) | ||
| } | ||
|
|
||
| func findNext() { | ||
|
|
@@ -5092,10 +5092,7 @@ extension BrowserPanel { | |
| if replaySearch, !state.needle.isEmpty { | ||
| executeFindSearch(state.needle) | ||
| } | ||
| postBrowserSearchFocusNotification( | ||
| reason: "restoreAfterNavigation", | ||
| generation: searchFocusRequestGeneration | ||
| ) | ||
| postBrowserSearchFocusNotification(reason: "restoreAfterNavigation", generation: searchFocusRequestGeneration, selectAll: false) | ||
| } | ||
|
|
||
| private func executeFindSearch(_ needle: String) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.