When saving and the document needs to execute a command (e.g. callback.document.export) then we can no longer use our special run-loop mode, as command execution is now using queues, and queue dispatching is paused when running in a custom run-loop mode.
We don’t have a specific element associated with the result being announced so we use the current responder (unless it has accessibility ignored, in which case we do not post any notification).
Using the current responder is not ideal, but I do not know how we can either associate the notification with the find panel or post it as a global notification.
The standard doesn’t care which side the keyword is placed on, but placing it on the right makes it easier to read types.
E.g. reading “int const* const” from right to left we get “const pointer to const integer”.
While code reuse is an added benefit, the main motivation was to fix the appearance of the action popup button in the Find window. The first (placeholder) item in the Find window's action button was assigned a nop action so that when the button was clicked and it's menu validated, the "action" image would always appear as disabled.
Since we are using it with an NSDocument, it defaults to use NSDocumentController as restoration class, which gives a warning during launch, if the find window was open during termination, and the conditions are so that the system wants to restore windows from last session.
Also indicate that we do not want to save drafts, unsure if this has any effect.
This is because we are using an NSDocument to perform the folder searching (as that’s a decoupled way to have the window indicate “unsaved changes” and present a warning sheet).
The downside is that by using an NSDocument we get some undesired implicit behavior, like automatically changing the window title or trying to re-open the “document” after relaunch.
We shouldn’t use Apple’s prefix for our own constants. The actual value of the constant hasn’t been renamed yet as this requires “migration” (renaming the key in user defaults).
We already commit the values when focus is lost, but it’s possible to initiate a find operation while focus is still in the find dialog text fields (via the menu).
Fixes#1183
For this change I have made the FFDocumentSearch class inherit from NSDocument. This way, we can register it with the window controller and will get callbacks when the window is about to close, with the option to cancel closing of the window. This approach seems much simpler than the alternative, which would be to introduce our own callback/delegate system for window closing, or have the window controller know about saving files.
We now show “Stopped.” as status text when search is prematurely terminated.
Closing window also cause search to stop.
The stop button has ⌘. as key equivalent (the standard “cancel” key).
Don’t let the stop action go via the search action dispatcher.
If the user does a folder search then ⌘G will step through all the matches, opening documents as required. Previously the user would have to do a new search, using a different search string, to stop ⌘G from moving to a new document. It is now possible to stop the behavior using ⌘F followed by ↩.
This is the action method sent by the Edit → Find → Find All (⌥⌘F) menu item, and is now treated as an alias to the existing findAll: action method (that the Find All button in the find dialog sends).
Untitled documents have no path, so we were creating a dictionary with a nil object. The path isn’t actually used (we go via the identifier) so removing the potential path from the dictionary avoids the problem.
Previously we ignored clicks and only selected matches when the selection was changed. This was done to prevent firing off two “select match” actions. We now ignore the “selection changed” notification if the current event is a mouse-up.
I find myself often closing folder search results and later re-opening (via ⇧⌘F) which would previously have the status string cleared, yet the results still showing.
Status should probably be stored together with the folder search results, so when toggling between document and folder search, the status string would follow as well.
Previously doing a Find All in Document would stay with Find All as the default button, even if closed and re-opened.
We also clear the status text, this isn’t always desirable, but I find it more weird when the dialog shows an outdated status message.