Commit Graph

3922 Commits

Author SHA1 Message Date
Allan Odgaard
c2335baaaf Release document observer before reaching our destructor
Releasing the document observer will trigger a “document will delete” notification, and I am seeing a few crashes from this. I don’t see any theoretical problem with posting this from the destructor, as the object is still “live”, but let’s see if this change doesn’t fix the crashes.
v2.0-beta.11.8
2016-07-12 20:04:04 +02:00
Allan Odgaard
6e8537fe78 Introduce API to obtain settings for a document 2016-07-12 11:35:29 +02:00
Allan Odgaard
7dbb44c4a0 Make parallel test execution the default (again) 2016-07-12 11:35:29 +02:00
Allan Odgaard
c23d0507ae Change button title to Save when asking user about encoding v2.0-beta.11.6 2016-07-12 11:00:11 +02:00
Allan Odgaard
19ced5ac0f Limit “encoding preview” to 256 KiB 2016-07-12 11:00:11 +02:00
Allan Odgaard
0f15e79a85 Make sheet presentation part of our EncodingWindowController 2016-07-12 11:00:11 +02:00
Allan Odgaard
dc7d61675f Use beginSheetModalForWindow:completionHandler: when available (10.9) 2016-07-12 11:00:11 +02:00
Allan Odgaard
4b19e40440 Show error message when trying to install blacklisted plug-in 2016-07-12 11:00:11 +02:00
Allan Odgaard
a6e1ae37f4 Do not sniff file type for documents with explicit user binding 2016-07-12 11:00:11 +02:00
Allan Odgaard
81d2586ffc Introduce plug-in blacklist which defaults to io.emmet.EmmetTextmate
We have been detecting plug-in crashes for about two years, and we offer the user to remove crashing plug-ins, nonetheless we are still getting a significant number of crash reports from loading the Emmet plug-in.
2016-07-12 11:00:11 +02:00
Allan Odgaard
ee26676df4 Remove unnecessary forward declaration of document_ptr 2016-07-12 11:00:10 +02:00
Allan Odgaard
1a7ef1af2b Improve termination UX with unsaved changes
Previously when multiple windows had unsaved changes we would use the frontmost window (with unsaved changes) for all the dialogs. Now we always bring to front the document for which we are presenting a sheet (like a save panel or encoding error).
2016-07-11 12:27:05 +02:00
Allan Odgaard
78c57eb213 Let showCloseWarningUIForDocuments: accept OakDocuments 2016-07-11 12:27:05 +02:00
Allan Odgaard
b6f111f0c9 Don’t cancel app termination when we need to show a save panel
Our previous save code was incompatible with the app termination event loop, so we had to abort app termination, but the updated code does not seem to have any issue.
2016-07-11 12:27:05 +02:00
Allan Odgaard
59f31a46a8 Remove old code used for saving documents 2016-07-11 12:27:05 +02:00
Allan Odgaard
b0ca4b1773 Use new save API in DocumentController 2016-07-11 12:27:04 +02:00
Allan Odgaard
84ecf729bd Use displayNameWithExtension: instead of DefaultSaveNameForDocument 2016-07-10 23:40:17 +02:00
Allan Odgaard
94d29d0aef Update document_t::sync_save to use new saving API
This function is only called by tests and should not be used by new code.
2016-07-10 23:40:17 +02:00
Allan Odgaard
7929a3fbdf Use new document save API from find window 2016-07-10 23:40:16 +02:00
Allan Odgaard
1e1206f303 OakShowAlertForWindow will queue alerts when sheets are already showing 2016-07-10 23:40:16 +02:00
Allan Odgaard
651d451b89 Add OakDocument API for saving 2016-07-10 23:40:16 +02:00
Allan Odgaard
c12867182b Loading document can succeed, fail, or be cancelled by user 2016-07-10 23:40:16 +02:00
Allan Odgaard
73fba5b72b Remove unused import statement 2016-07-10 23:40:16 +02:00
Allan Odgaard
1d78a4fc83 Don’t initialize variable to expected value (to improve test) 2016-07-10 17:49:43 +02:00
Allan Odgaard
a6ecde745d Change how we run NSSpellChecker code on the main thread
We only run uniqueSpellDocumentTag and closeSpellDocumentWithTag: on the main thread, as the spelling methods themselves should be thread safe and do not cause any tests to fail (even when running them in parallel).

The way we check if we must “jump” to main thread is done by looking at our current run loop rather than using the deprecated (as of 10.9) dispatch_get_current_queue() function. Since we are looking at the run loop, we now use CFRunLoopPerformBlock() instead of the dispatch functions.
2016-07-10 17:49:43 +02:00
Allan Odgaard
168c06402c Setup CFRunLoop in test runner 2016-07-10 17:49:43 +02:00
Allan Odgaard
1eae742111 Add info about avoiding libressl linker warnings 2016-07-10 17:49:43 +02:00
Allan Odgaard
d2d56aaee7 Explicitly call onig_init()
This is called the first time we create a regular expression, but first use of the library could be concurrent (at least for some of the tests).
2016-07-10 17:49:43 +02:00
Allan Odgaard
bc703249e5 Ensure NSDocumentController is used only from main thread 2016-07-10 17:49:43 +02:00
Allan Odgaard
df3ef3cd81 Don’t delay “did save” notification to next event loop cycle
See 26e66b887a for details.
2016-07-10 17:49:39 +02:00
Allan Odgaard
26e66b887a Use current run loop instead of main dispatch queue
While the previous changes were motivated by the tests, this one affects TextMate in that we run a local event loop if we want to wait for commands to finish, but as we previously used the main dispatch queue to send back command results, it meant that we could not wait for command completion from a block running in the main queue.

Currently the code works around this by using performSelector:withObject:afterDelay: when there is a chance of being in a local event loop, which is no longer required.
2016-07-10 11:29:42 +02:00
Allan Odgaard
61aa554dbd Use current run loop instead of main dispatch queue
This change is for the tests which are not being run in the main queue, so it is wrong to assume that we can use the main queue for callbacks.
2016-07-10 11:29:42 +02:00
Allan Odgaard
3d4d8d4ca3 Code formatting change 2016-07-10 11:29:42 +02:00
Allan Odgaard
c6efe7a06a Remove CGRectLessThan
This was never used for anything.
2016-07-10 11:29:41 +02:00
Allan Odgaard
29d2e52e13 Remove cf::image_t
This was previously used by layout_t but not since we introduced the CGContextRef wrapper (in b6ed16251e).
2016-07-10 11:29:41 +02:00
Allan Odgaard
d999aa7e39 Remove cf::timer_t
This was previously used by document_t to schedule backups.
2016-07-10 11:29:41 +02:00
Allan Odgaard
60180f77ec Let OakDocument post will/did save notification
With this change we only have OakTextView observe its current document.

This does mean that currently pre and post bundle actions are only executed for the selected document.
2016-07-10 11:29:41 +02:00
Allan Odgaard
6495435833 Add description method to OakDocument 2016-07-10 11:29:41 +02:00
Allan Odgaard
a425ec3c27 Use displayNameWithExtension: when creating backup name 2016-07-08 10:13:48 +02:00
Allan Odgaard
a00a4c2d86 Add displayNameWithExtension: method to OakDocument
This will also ensure the display name does not contain any slashes (which it can when a custom name is set) so that it is safe to use this as a filename.
2016-07-08 10:13:48 +02:00
Allan Odgaard
9e06e35225 fixup! Use selected document’s path to find external scope attributes 2016-07-08 10:13:48 +02:00
Allan Odgaard
9deb1bf1be Remove content argument from didSave callback method 2016-07-08 10:13:48 +02:00
Allan Odgaard
3a84c1ca3c Simplify code to find a grammar’s file extension 2016-07-08 10:13:48 +02:00
Allan Odgaard
0e5e448295 Remove unused file type argument to file::save 2016-07-08 10:13:47 +02:00
Allan Odgaard
7619e6e9c2 Store document’s file type in session restore info 2016-07-07 12:19:45 +02:00
Allan Odgaard
da47f80aaa Only update grammar and indent settings for open documents 2016-07-07 12:19:45 +02:00
Allan Odgaard
1bab8548af Set project directory when restoring session
We would only set the “default” project directory and rely on the effective project directory being set when opening first document, however, for untitled documents we need the effective project directory to be setup prior to opening (to read the correct settings).
2016-07-07 12:19:45 +02:00
Allan Odgaard
9f1641911a Remove create_untitled_document_in_folder helper function 2016-07-07 12:19:45 +02:00
Allan Odgaard
2d50db451b Don’t update settings when creating untitled documents
This is now done (properly) when we open the document.
2016-07-07 12:19:45 +02:00
Allan Odgaard
5ef7bf1b9b Set document’s directory before opening it
This ensures we get proper folder specific settings for untitled documents that belong to a project.
2016-07-07 12:19:45 +02:00