Allan Odgaard
c624424539
Add kSearchIgnoreOrderingKey for when enumerating documents at path
...
This will return all open documents before starting to scan the disk and should make functionality like Open Quickly… (⌘T) feel faster (if enabled).
2016-10-22 23:27:16 +07:00
Allan Odgaard
948d7106d8
Add openDocumentsInDirectory: method for all open documents in folder
2016-10-22 23:27:16 +07:00
Allan Odgaard
05749c5c64
Document creation in background thread could fail
...
This is because we remove the document record in dealloc (unregister), but at that time, the reference in the record (for the path/inode) has already been zeroed, so if a document is created for the same path/inode after the reference has been zeroed but before the record has been unregistered, we would use the zeroed reference as the result from documentWithPath:.
2016-10-22 23:27:15 +07:00
mathbunnyru
440414f96c
Use nullptr in all C++ files instead of NULL
...
This brings us a bit of extra type safety, for example where an integer is expected, nullptr should be disallowed by the compiler (unlike NULL).
2016-10-22 21:40:14 +07:00
mathbunnyru
08ad760d5e
static_cast instead of c-style cast
2016-10-18 23:06:48 +02:00
Allan Odgaard
3acace3121
Remove document_t and related tests
...
Tests should be ported to OakDocument.
2016-10-17 10:07:29 +02:00
Allan Odgaard
a278bfd5fe
Postpone loading document changes when processing user edit event
...
When running bundle commands we run a local event loop which means that we can receive events such as “document changed” while still waiting for the bundle command to finish.
2016-10-11 13:02:36 +02:00
Allan Odgaard
7be3703404
Change user defaults to .tm_properties for disabling extended attributes
2016-10-11 10:36:49 +02:00
Allan Odgaard
8e0b22507a
Use LEGACY marker for code that should eventually be retired
...
This is to make it easier to search for such code.
2016-10-10 22:39:16 +02:00
Allan Odgaard
4f9446ae30
Preserve a document’s visible index when updating its selection
...
Both the selection and visibleIndex property should be reworked, as it’s not really document properties.
2016-10-10 22:38:00 +02:00
Allan Odgaard
6a61853183
Setting a document’s selection now resets its “visible index”
...
When a document has a visible index then we scroll to this index, on bringing the document to front. This is not desired when we set the selection, since we basically do that to “scroll to this location”.
2016-10-07 10:02:58 +02:00
Allan Odgaard
bf747370a8
The “first line” sniffing done when changing path now work on first 2 kb
...
We do have a few patterns that match multiple lines, e.g. the XML plist.
The problem would happen if a document was opened using a multi-line “first line” match, but another grammar matched its extension. If this document changed location (same extension), it would switch to use the grammar that matched its extension.
2016-10-07 10:02:58 +02:00
Allan Odgaard
b598784dbe
Don’t make assumptions about document having a path
2016-09-30 12:44:01 +02:00
Allan Odgaard
07a44f7540
Always wrap document saving in open/close and inline didSaveAtPath:
...
Since open no longer tries to load the document it is safe to call even for a document with isLoaded == NO.
2016-09-29 09:56:49 +02:00
Allan Odgaard
e59b023119
Post OakDocumentContentDidChangeNotification for all buffer changes
2016-09-28 20:56:55 +02:00
Allan Odgaard
e93f34b5ab
Only remove buffer callback if added
...
This is incase our initializer fails, here dealloc is still called, but we didn’t get to add the callback so we should not try to remove it.
Why our initializer would fail is beyond me, but I see a few crashes from this (though all from the same user on 10.8.5).
2016-09-27 21:49:32 +02:00
Allan Odgaard
2bf803b889
Post OakDocumentWillSaveNotification before reading extended attributes
...
The notification makes the text view update the visualIndex (saved as an extended attribute) so previously we would save the previous value for this attribute.
2016-09-26 11:11:15 +02:00
Allan Odgaard
e6ed50c107
Introduce kMacClassicThemeUUID since we reference it in multiple places
2016-09-26 11:09:32 +02:00
Allan Odgaard
d8312b833e
Rely on NSUUID overload of to_s
2016-09-26 11:09:16 +02:00
Allan Odgaard
7cb8755a66
Fix issue with updating bufferEmpty property
...
We should initiate it to YES and the logic for when to skip updating was wrong because of precedence.
2016-09-26 08:09:58 +02:00
Allan Odgaard
973e38a383
Fix leak: buffer_callback_t
2016-09-25 07:31:13 +02:00
Allan Odgaard
14cdd420d3
Make backupPath property public
2016-09-24 09:37:31 +02:00
Allan Odgaard
b7e4f3bc4f
Make OakDocument’s saveBackup: public API
...
This is required when saving session state.
2016-09-24 09:37:31 +02:00
Allan Odgaard
2f363060ee
Make OakDocument’s isBufferEmpty property public
2016-09-24 09:37:30 +02:00
Allan Odgaard
331c2c08b4
Remove document::show API
2016-09-24 09:37:30 +02:00
Allan Odgaard
edaf02a6c3
Remove document_t callback system
2016-09-24 09:37:29 +02:00
Allan Odgaard
eef0878538
Remove document::show_browser
...
Instead use OakDocumentController’s showFileBrowserAtPath:
2016-09-24 08:55:18 +02:00
Allan Odgaard
38a2cd6c1e
Remove revision and savedRevision from document API
2016-09-24 08:33:34 +02:00
Allan Odgaard
eb6b66181d
Add markDocumentSaved API to OakDocument
...
This clears the isDocumentEdited flag and also does a “snapshot” for potentially future diff against changes on disk.
2016-09-24 08:33:33 +02:00
Allan Odgaard
9a4db4665d
Add “show document” API to OakDocumentController
...
This is currently just a wrapper for the old C++ API.
2016-09-24 08:33:33 +02:00
Allan Odgaard
558eab8b13
Only set document revision and emptyBuffer properties on actual changes
...
These generate change notification for all the properties that depend on them (like isDocumentEdited and thus icon) even when set to the same value.
2016-09-24 08:33:33 +02:00
Allan Odgaard
c893dd6ba2
Reset document icon with isOnDisk changes
2016-09-24 08:33:32 +02:00
Allan Odgaard
49dadbd474
Remove backup file when setting keepBackupFile = NO
2016-09-24 08:33:32 +02:00
Allan Odgaard
49e99537a8
Allow passing nil to didTouchDocument:
2016-09-24 08:33:32 +02:00
Allan Odgaard
0cc15c10d2
Add API to create untitled document
2016-09-24 08:33:32 +02:00
Allan Odgaard
ba7ef25d66
No need for document editor to observe content did change notification
2016-09-21 22:20:39 +02:00
Allan Odgaard
bedf79aff3
Fix issue when loading the same document simultaneously
...
This could happen when restoring a session where the same document was open in multiple windows.
2016-09-21 20:39:42 +02:00
Allan Odgaard
5de8e6fd58
Sanitize selection if buffer is changed outside change group
2016-09-21 20:39:42 +02:00
Allan Odgaard
981b7a6d8f
Move undo grouping to OakDocumentEditor
2016-09-21 20:39:42 +02:00
Allan Odgaard
c0b4e7319c
Only regular expression searches use file size limit for non-open files
2016-09-21 20:39:42 +02:00
Allan Odgaard
ad01eb1ac6
Use stringArrayForKey: where appropriate
2016-09-21 20:39:41 +02:00
Allan Odgaard
53a6708c08
Add API to search for documents at multiple locations
2016-09-20 18:15:20 +02:00
Allan Odgaard
7cc017f343
Harmonize all implementations of sharedInstance
2016-09-19 12:54:19 +02:00
Allan Odgaard
238ee0cc4f
Load potential backup before operating on non-loaded documents
2016-09-19 12:48:12 +02:00
Allan Odgaard
bc6c05086a
Include untitled document’s directory in their description
2016-09-18 13:26:13 +02:00
Allan Odgaard
05711359a0
Also return untitled documents from enumerateDocumentsAtPath:
...
We look at the document’s directory property to see if it is within the folder being searched.
2016-09-18 13:26:13 +02:00
Allan Odgaard
9e5c4f27b6
OakDocumentController’s openDocuments now return a sorted array
2016-09-18 13:26:13 +02:00
Allan Odgaard
abeaa0498f
OakDocument’s icon now indicate when a file is missing on disk
2016-09-18 13:26:12 +02:00
Allan Odgaard
1627a62b90
Clear document’s directory property when changing path
...
This is just for good measure.
2016-09-18 13:26:12 +02:00
Allan Odgaard
87dafa3332
Only let untitled documents read settings via directory property
2016-09-18 13:26:12 +02:00