Commit Graph

334 Commits

Author SHA1 Message Date
Allan Odgaard
5a5f5e8d75 Make folder search depth-first 2016-11-13 16:22:04 +07:00
Allan Odgaard
9d980a07df Remove NSPrincipalClass from framework bundles’s Info.plist
This is not something which is used anywhere and a few of the frameworks does not have a principal class.
2016-10-31 17:30:30 +07:00
Allan Odgaard
03d912e7c4 Bump date of find/replace pasteboard history items when they are used
Currently this bumping is limited to the Find dialog and happens when executing a search. Selecting from the Show Find History or subsequently using ⌘G, does not bump the date of the selected item (but probably should).
2016-10-10 22:37:12 +02:00
Allan Odgaard
1d7c168cb8 Rework logic for when search result selection should select in document
There are two issues here, one is that double-clicking a result sends both “selection did change”, “did single click” and “did double click” messages, which all should potentially select the result in the document, but this does introduce a bit of overhead, although I think this is insignificant.

The other issue is that a “single click” or “selection did change” shouldn’t select in the document when the user is selecting multiple items, which is useful for the various Copy actions.
2016-10-07 10:02:58 +02:00
Allan Odgaard
9fd239c78b Ensure we do not create zero-sized NSImage 2016-10-01 08:59:28 +02:00
Allan Odgaard
5f11d65308 Force find/replace text fields to recreate display string
The previous attempt does not work on macOS 10.12, presumably because the object value doesn’t actually change, despite the setter being invoked.
2016-09-30 14:10:39 +02:00
Allan Odgaard
e6f4f2dc40 Use atomic getter/setter to access lastDocumentPath
There was a race-condition since we update it in the background queue, where it could be released, and using it in the main queue does not retain it before use.
2016-09-29 09:56:50 +02:00
Allan Odgaard
4a260811ec Change URL scheme to https 2016-09-29 09:56:50 +02:00
Allan Odgaard
3c150d34aa Ensure we only remove observer that we previously added
We were previously assuming that the viewWillMoveToSuperview: was only called when moving to a view and then later when removed, but for 10.8.5 it appears that it might be called multiple times (with a nil superview), causing us to remove ourself as observer from something we didn’t observe.
2016-09-26 21:01:04 +02:00
Allan Odgaard
b0d2a93040 Fix placement of search results checkboxes 2016-09-26 11:14:23 +02:00
Allan Odgaard
9e949e3eda Use NSUUID for project identifier (instead of NSString) 2016-09-26 11:08:22 +02:00
Allan Odgaard
b1f92d1415 Skip work when regular expression property is set to its existing value 2016-09-26 08:09:58 +02:00
Allan Odgaard
12ca096ccb Enable syntax highlight for find and replace text fields
These use the source.regexp.oniguruma and textmate.format-string grammars respectively, both in the TextMate bundle.
2016-09-26 08:09:58 +02:00
Allan Odgaard
dc5028f039 Let text view and find window show documents using OakDocumentController 2016-09-24 08:33:33 +02:00
Allan Odgaard
631ced7b3c Introduce keepSearchResultsOnDoubleClick user defaults key
This prevents the find dialog from closing when double-clicking search results.
2016-09-22 09:22:56 +02:00
Allan Odgaard
1f6b87d4ea Double-clicking inactive search results would not trigger select action 2016-09-22 09:22:56 +02:00
Allan Odgaard
7713496749 Searching “other” folder would still use project folder 2016-09-21 22:20:39 +02:00
Allan Odgaard
017f4a3ba1 Check if path is a folder before calling path::entries()
This is just to suppress a warning from path::entries().
2016-09-21 20:39:42 +02:00
Allan Odgaard
2f5b8559fb Only add folders to find dialog’s Recent Places
Now that documents selected in the file browser can be searched, we can end up with a document path in the ‘otherFolder’ property.

This would happen by selecting a document in the file browser, opening the find dialog, and then selecting this document in the pop-up, as it is listed in the pop-up with a menu item tag of “FFSearchTargetOther”.
2016-09-21 20:39:42 +02:00
Allan Odgaard
2ffbfe02a5 Remove find::kSearchOpenFiles constant 2016-09-20 20:04:33 +02:00
Allan Odgaard
1087a68f44 Add “File Browser Items” as find dialog search target 2016-09-20 20:04:19 +02:00
Allan Odgaard
4dc3de163e Guard against infinite loop 2016-09-20 20:03:32 +02:00
Allan Odgaard
9d97662b89 Let FFDocumentSearch accept an array of paths 2016-09-20 20:02:08 +02:00
Allan Odgaard
315735a13a Add helper function for common ancestor 2016-09-20 19:55:16 +02:00
Allan Odgaard
c04430ebe4 FFDocumentSearch no longer search current document or open files 2016-09-20 18:20:36 +02:00
Allan Odgaard
d7f4b5bfb6 Use ‘enabled2’ in binding since we already bind to ‘enabled’
Before the Replace & Find button was enabled for folder searches.
2016-09-20 18:19:20 +02:00
Allan Odgaard
dbee4704cc Clear the countOfMatches properties after unbinding
The Replace All button’s enabled state is based on count of matches (via bindings), so unbinding would leave it possibly enabled when it should have been disabled.
2016-09-20 18:17:37 +02:00
Allan Odgaard
2e61de9f7d Do not show missing items under Recent Places in folder search 2016-09-20 18:17:06 +02:00
Allan Odgaard
e20bb55d18 Use home folder as fallback in FFFolderMenu
This is to avoid an exception when the code is used with menu items that have no represented object (which it normally wouldn’t in shipping code, but it seems it should be supported nonetheless).
2016-09-20 18:16:41 +02:00
Allan Odgaard
330695a775 Import Find.h instead of redeclaring some of its symbols 2016-09-20 18:14:07 +02:00
Allan Odgaard
e3874bcecb Only set menu item image when required
The system can be updating the menu only to resolve a key equivalent, hence the image is not required. The document icon can be a little expensive to create because of the SCM badge. This would be noticeable when doing a folder search with hundres or thousands of results and then pressing ⌘1, here it would previously need to create all the document icons before responding to the key.
2016-09-20 18:12:13 +02:00
Allan Odgaard
7cc017f343 Harmonize all implementations of sharedInstance 2016-09-19 12:54:19 +02:00
Allan Odgaard
297cfa1726 Remove unused OakFileIconImage.h includes 2016-09-19 12:49:03 +02:00
Allan Odgaard
5f53075864 Disable recent tracking for non-open documents instead of non-loaded 2016-09-18 10:33:45 +02:00
Allan Odgaard
d66b2b982d Search open files using OakDocument’s isOpen property 2016-09-18 10:33:20 +02:00
Allan Odgaard
ddefdec649 Change document’s isOpen property to isLoaded
Since we do not load documents before the user selects them, e.g. after session restore or when opening multiple documents, it makes sense to have both an isOpen and isLoaded property, the former means “is shown somewhere in the UI” and would make it appear (e.g. in file browser) with close button etc., whereas the latter means that data has been loaded from disk, and we can safely access the buffer.
2016-09-18 10:29:21 +02:00
Allan Odgaard
cd58781f19 Increase find results update interval from 0.03 to 0.20 seconds
It looks better when we have a “full page” of results on the first update, rather than building up the first page of results file-by-file with only 0.03 seconds between each “increment”.
2016-09-18 10:29:20 +02:00
Allan Odgaard
9aafadbe25 Fix retain cycles responsible for leaked NSTableCellView objects 2016-09-18 10:26:00 +02:00
Allan Odgaard
4b000cc633 Rename scannerProbeTimer variable to folder search code
This is so that the code mimics FileChooser.mm
2016-09-18 10:25:53 +02:00
Allan Odgaard
83113e4765 Use NSUUID for documentIdentifier properties 2016-09-18 07:32:05 +02:00
Allan Odgaard
4307501170 Let type of kSearchMarkIdentifier be NSString 2016-09-16 15:45:18 +02:00
Allan Odgaard
d8a18057fa Remove find::match_t 2016-09-16 15:40:13 +02:00
Allan Odgaard
7314f7391c Use OakDocumentMatch instead of find::match_t 2016-09-16 15:40:10 +02:00
Allan Odgaard
61f6835f9f Track FFResultNode leaks 2016-09-16 15:39:33 +02:00
Allan Odgaard
d021ba0eb2 Clearing search results would still keep FFResultNode objects around
Since the checkbox button shown in the search results had its values bound directly to an FFResultNode instance, it would retain this object for as long as the checkbox was around, which is basically forever, although it could be reused with another FFResultNode instance, in which case the previous instance would be released.

To avoid this, we have introduced an NSTableCellView that stores the FFResultNode instance as its object value, and the checkbox uses a key path that goes via the object value for the bound values. This still creates a retain cycle, but the NSOutlineView will set all object value properties to nil when its data is cleared, thereby at least releasing the FFResultNode objects.
2016-09-16 15:39:33 +02:00
Allan Odgaard
a914aaea99 Remove unused property 2016-09-16 15:39:33 +02:00
Allan Odgaard
fcee7b38ab Remove find::scan_path_t 2016-09-16 15:39:33 +02:00
Allan Odgaard
aacfb3f127 Use OakDocument/OakDocumentController for folder search 2016-09-16 15:38:43 +02:00
Allan Odgaard
aef8529bc6 Use NSTimer instead of OakTimer
This requires the document search to be stopped explicitly rather than released, but I think this is an acceptable requirement. If it is not stopped, the search will simply run its course, which would also have been the case, if something else was retaining the object.
2016-09-16 15:12:15 +02:00
Allan Odgaard
fb929aee10 Remove redundant member data 2016-09-14 21:46:07 +02:00