Commit Graph

3735 Commits

Author SHA1 Message Date
Allan Odgaard
fb7c2cef3f Use NSUserDefaults’s specialized «type»ForKey: 2016-06-20 11:43:40 +02:00
Allan Odgaard
bc20f67d05 Revert "Search results are now added in batch to limit KVO notifications"
This was published by mistake as 8175d2d9d8 address the same problem but with less complex code.

This reverts commit f7edb51ea3.
2016-06-19 22:08:36 +02:00
Allan Odgaard
89376e6ac9 Always ask OakFileBrowser to validate deselectAll: and reload:
Also simplify code so that we only need to maintain a set of which actions the file browser should validate.
2016-06-19 09:40:09 +02:00
Allan Odgaard
6e8ab01c09 Let OakFileBrowser validate menu items sending deselectAll: 2016-06-19 09:40:08 +02:00
Allan Odgaard
0a0b9a8052 Move Select None to File Browser (main) menu
This was previously placed in the file browser’s action menu and thus probably overlooked by many, even though ⇧⌘A is a very useful key equivalent, since many commands work on the entire project when there is no selection in the file browser.
2016-06-19 09:40:08 +02:00
Allan Odgaard
dc0331b781 Change File Browser → Current Document to Select Document
Also make the title dynamic so that we show the current document’s name (when we have one) and add a separator below the menu item.
2016-06-19 09:40:08 +02:00
Allan Odgaard
5c7b04fbd3 Add missing include for test/jail.h 2016-06-19 08:45:16 +02:00
Ronald Wampler
7e3497889e Rename "Go" menu to "File Browser" 2016-06-19 08:45:16 +02:00
Ronald Wampler
1a1c3ecd38 Move "Go To Related File" to the Navigate menu 2016-06-19 08:45:16 +02:00
Ronald Wampler
5bb89898fb Move "Go to File" to File menu and rename to "Quick Open" 2016-06-19 08:45:16 +02:00
Ronald Wampler
e452a5ee55 Move "Go to Tab" to the Window menu and rename to "Select Tab"
Also edit the source to reflect the change in name (e.g., `updateGoToMenu:` → `updateSelectTabMenu:`).
2016-06-19 08:45:16 +02:00
Mike Meyer
91befc271b Read the gutter fontName from user defaults
defaults to textView fontName
2016-06-19 08:33:03 +02:00
Allan Odgaard
a4deade16a Show path of default keybindings as TextMate.app ▸ KeyBindings.dict
This is instead of showing the full path. The user can still get to the file by using the “Edit” button.
2016-06-18 12:15:32 +02:00
Allan Odgaard
45a23472cb Use localized number formatting for collapsed search result headers 2016-06-18 12:15:32 +02:00
Allan Odgaard
b232a70d69 Remove countOfLeafs property from OakSearchResultsHeaderCellView 2016-06-18 12:15:32 +02:00
Allan Odgaard
f7edb51ea3 Search results are now added in batch to limit KVO notifications
Majority of the time in the main thread was spent updating the countOfLeafs property since canReplaceAll and the result text are dependent on this property.
2016-06-18 12:15:32 +02:00
Allan Odgaard
5d9ad561dc Deleting last item in pasteboard history browser is now a no-op
Unfortunately disabling the “Delete” button is cumbersome because our history is stored with CoreData so knowing the number of items in the history requires a fetch request, which we would not know when to re-run (to update the disabled state when the history is changed).

When the filter string is empty we can use the array controller’s results, but I’m leaving that for the future.
2016-06-18 11:29:13 +02:00
Allan Odgaard
705fc6e0e9 Change “Clear All” → “Clear History” in pasteboard history browser
Technically we are unable to delete the pasteboard’s current item so “Clear All” was performing a “Clear All Minus One”. While the new label does not make this clear, it at least does not promise to clear everything.
2016-06-18 11:29:13 +02:00
Allan Odgaard
3346f8e237 Use operator== from document_t instead of its identifier’s
This serves to make the code slightly more abstract and allows the document to optimize the comparison operator, e.g. testing pointer equivalence before involving more complex checks.
2016-06-18 11:29:13 +02:00
Allan Odgaard
8175d2d9d8 Do not observe count of matches until search has completed
We do not display this counter during the search but triggering a KVO notification for each search result has a noticeable overhead and can result in unresponsive UI when the number of results are in the hundreds of thousands.
2016-06-18 11:29:05 +02:00
Allan Odgaard
994f3538f5 Clear old search results in setDocumentSearch:
That we have an empty results array is a prerequisite for starting a document search, so we should do it in the method itself.
2016-06-18 10:34:49 +02:00
Allan Odgaard
3fab3fe3d0 Use CoreFoundation when converting NSString → std::string
This is significantly faster on OS X 10.11.

The API is slightly different so this is probably still faster in macOS 10.12 where there should be less of a performance difference between using Foundation and CoreFoundation.
2016-06-18 10:34:49 +02:00
Allan Odgaard
8483826fae Always use '\0' as fill value when creating a string buffer 2016-06-18 10:34:08 +02:00
Allan Odgaard
5d4a14e14b Bundle Editor: Set bundle item’s name as document’s custom name
This affects the name used for backup files and TM_DISPLAYNAME which could be used by some commands invoked from the bundle editor.
2016-06-17 17:42:57 +02:00
Allan Odgaard
267ad147cd Checkin release notes v2.0-beta.9.5 2016-06-16 20:25:18 +02:00
Allan Odgaard
c0637c1037 Fix issue with “one file searched” format string
When using $n in a format string placeholder for n > 1 then we must also include $n-1.
2016-06-16 20:04:26 +02:00
Allan Odgaard
258e5449f1 Improve folder search performance
This relates to documents with many matches on the same (long) line.

Previously we would search for “end of line” per match found, which for a single-line document was effectively quadratic time complexity.

Furthermore we would make a string copy of the entire line for every match. This is now limited to 500 bytes (or longer if the match requires it) with the context before the match being up to 150 bytes (it’s using modulo so adjacent matches should generally show context starting from the same offset).

The test case for the optimization was a 3MB file with only 2 lines and 150,000 matches. After this commit the results are presented in about two seconds (Macbook Pro). Not impressive but much better than before :)
2016-06-16 20:04:21 +02:00
Allan Odgaard
41ed2817e7 Remove unused ‘searchBackups’ argument from document::find
The function will always search backups and so far there has not been a reason to disable it.
2016-06-16 10:53:11 +02:00
Allan Odgaard
d2b29d69af Delete layout and editor objects before closing document
Both of these objects may observe the buffer owned by the document, so we should be sure the observers are gone since closing a document may delete its buffer.
2016-06-16 10:50:25 +02:00
Ronald Wampler
976a79468b Prefix some of the menu items in Navigate with "Jump to"
The Navigate menu now contains a mixture of items with prefixes "Jump to", "Go to" or none at all. The "Go to" prefix is especially inconsistent since we have already have a dedicate "Go" item in the Main menu bar. For consistency, change them to use the "Jump to" prefix.

The commit also renames the appropriate dialog boxes and updates some documentation to refer to the new names.
2016-06-14 20:55:42 +02:00
Ronald Wampler
accb60033e Move "Jump to Selection" to the Navigate menu
Most Apple applications have this item placed under Edit → Find; however, it fits more naturally in our Navigate menu.
2016-06-14 20:55:13 +02:00
Ronald Wampler
162b3dee2c Explicitly link with libc++
When building with Xcode 8 beta (on my system at least), clang produced the following warning:

clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9

It appears clang will link with libstdc++ if present by default instead of libc++. This was verified using `otool -L bundles.dylib` which produce the following output prior to this change.

bundles.dylib:
	@rpath/bundles.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/OakSystem.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/io.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/plist.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/regexp.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/scope.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/text.dylib (compatibility version 1.0.0, current version 1.0.1)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 104.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

With this change the output is now:

bundles.dylib:
	@rpath/bundles.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/OakSystem.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/io.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/plist.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/regexp.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/scope.dylib (compatibility version 1.0.0, current version 1.0.1)
	@rpath/text.dylib (compatibility version 1.0.0, current version 1.0.1)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
2016-06-14 20:49:31 +02:00
Ronald Wampler
2ffc48fda9 Don't link network framework with crypto 2016-06-14 20:49:26 +02:00
Allan Odgaard
221026472d Change document_t source to Objective-C++ 2016-06-14 20:42:26 +02:00
Allan Odgaard
781eb82c43 Remove unused support for non-recursive document callbacks 2016-06-14 20:42:26 +02:00
Allan Odgaard
0e52185c00 Remove const versions of document_t’s buffer and undo_manager
Also remove the document_const_ptr typedef.
2016-06-14 20:42:26 +02:00
Ronald Wampler
2dbde1673b fixup! Ignore /usr/bin/git if /usr/bin/xcode-select -p fails 2016-06-14 10:40:07 -04:00
Allan Odgaard
67e4378a1e Don’t cache last-recently-used date in document_t
This optimization is hardly worth the added code complexity.
2016-06-13 13:02:50 +02:00
Allan Odgaard
cc03dd908e Remove document_t’s old reader API 2016-06-13 13:02:50 +02:00
Allan Odgaard
99de97f976 Use document_t’s visitor API for folder search 2016-06-13 13:02:50 +02:00
Allan Odgaard
e0daad4ca3 Add visitor interface to document_t
This exposes less types and thus it is easier to change the implementation.
2016-06-13 13:02:50 +02:00
Allan Odgaard
9d308e4aa0 Use file::reader_t directly (instead of file_reader_t wrapper) 2016-06-13 13:02:50 +02:00
Allan Odgaard
dfd4c1cd6f Remove unused reader subclasses 2016-06-13 13:02:49 +02:00
Allan Odgaard
a60e32b41a Draw selection in left/right margin when line is fully selected 2016-06-13 13:02:49 +02:00
Allan Odgaard
17574f3d0e Add crash log info to performDragOperation: 2016-06-13 13:02:49 +02:00
Allan Odgaard
c500e3073b Add document_t wrapper functions to document_view_t
This should make it possible to only deal with a document view (which retains the underlying document).
2016-06-13 13:02:49 +02:00
Allan Odgaard
18f4d8fc83 Minor simplification of document_view_t API 2016-06-13 13:02:49 +02:00
Allan Odgaard
3700332f3e Change how we obtain visible range for accessibility
This is so that we can remove the index_below function from document_view_t.
2016-06-13 13:02:49 +02:00
Allan Odgaard
a340811771 Allow access to buffer_t’s raw storage via the visitor interface
Previously this was done by exposing iterators but for this to go into the abstract base class we sort of need abstract iterators and that is too complex and visitor interface is sufficient for our single use case.
2016-06-13 13:02:49 +02:00
Allan Odgaard
b5747ec6a6 Return text::indent_t by value so we can create it on the fly 2016-06-13 13:02:49 +02:00