Commit Graph

219 Commits

Author SHA1 Message Date
Allan Odgaard
076863e954 Add some extra checks to potentially avoid crashes 2016-08-05 23:19:18 +02:00
Allan Odgaard
49cc601ae6 Only call NSData’s enumerateByteRangesUsingBlock: when available
This restores compatibility with 10.8.
2016-08-04 14:37:02 +02:00
Allan Odgaard
511e1d58a5 Remove old (crash reports) debug info 2016-07-16 13:14:43 +02:00
Allan Odgaard
93e9d23a7d Ensure “will save” callbacks run on buffer that gets written to disk 2016-07-16 13:14:43 +02:00
Allan Odgaard
07bb1ce28d Let OakDocumentEditor update document’s ‘selection’ property 2016-07-16 13:14:43 +02:00
Allan Odgaard
55c6f20b51 Let OakDocumentEditor update document’s ‘folding’ property
This has the advantage that we also get updated folding state saved with backups plus we do not burden the OakTextView with keeping metadata in sync.
2016-07-16 13:14:42 +02:00
Allan Odgaard
1f09c4292a Drop the OakDocumentEditorProtocol
This was only required when the OakDocumentEditor implementation was in a different framework (that OakDocument could not depend on).
2016-07-16 13:14:39 +02:00
Allan Odgaard
4d8cef31a0 Let OakDocumentEditor expose buffer_t
Although the buffer is maintained by OakDocument, it makes sense to only allow access via an OakDocumentEditor instance, since the buffer only exist when the document is loaded (implied by the presence of an editor).
2016-07-16 13:13:45 +02:00
Allan Odgaard
86719625d2 Limit what we import in a public header 2016-07-16 13:13:44 +02:00
Allan Odgaard
a7e6d2fcee Let OakDocumentEditor sanitize selection on external content changes 2016-07-16 13:13:44 +02:00
Allan Odgaard
5ec9aafc81 Add undo/redo API to OakDocument 2016-07-16 13:13:44 +02:00
Allan Odgaard
d285969887 Add ‘selection’ property to OakDocumentEditor
Currently setting the selection will clear any snippets.
2016-07-16 13:13:44 +02:00
Allan Odgaard
8d549d49d2 Move variables method to OakDocument 2016-07-16 13:13:44 +02:00
Allan Odgaard
750259fee1 Automatically update document’s revision after ending an undo group 2016-07-16 13:13:44 +02:00
Allan Odgaard
a0af3d98c0 Don’t redeclare private OakDocument interface 2016-07-16 13:13:44 +02:00
Allan Odgaard
c6bea5c3ff Update LINK dependencies in target files 2016-07-16 13:13:44 +02:00
Allan Odgaard
2ce7d39dbc Merge OakDocument into document framework 2016-07-16 13:13:44 +02:00
Allan Odgaard
978e16174b Add preliminary OakDocumentEditor registration to OakDocument 2016-07-16 13:13:41 +02:00
Allan Odgaard
fc33b25da1 Sort untitled documents after most recent use in Open Quickly… 2016-07-14 15:15:12 +02:00
Allan Odgaard
a5882463d4 Support no completion handler when loading document 2016-07-14 14:06:57 +02:00
Ronald Wampler
e50dc57db0 Manually release GCD objects in C++ libraries
Since these are pure C++ libraries, they are not managed by ARC. This commit partially reverts 469fd74a7b.
2016-07-14 12:21:28 +02:00
Allan Odgaard
59e48f0618 Post missing ‘document will save’ notification 2016-07-13 00:40:32 +02:00
Allan Odgaard
de8eedebc4 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.
2016-07-13 00:40:32 +02:00
Allan Odgaard
c23d0507ae Change button title to Save when asking user about encoding 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
a6e1ae37f4 Do not sniff file type for documents with explicit user binding 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
59f31a46a8 Remove old code used for saving documents 2016-07-11 12:27:05 +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
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
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
3d4d8d4ca3 Code formatting change 2016-07-10 11:29:42 +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
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
da47f80aaa Only update grammar and indent settings for open documents 2016-07-07 12:19:45 +02:00
Allan Odgaard
8fb18e3168 Add directory property to OakDocument
This is useful for untitled documents so that we know where to look for folder specific settings.
2016-07-07 12:19:45 +02:00
Allan Odgaard
e2b474cad6 Fix incorrect OakDocument initializer
When trying to open a non-existing document by UUID we would get back a partially initialized object.
2016-07-07 08:57:09 +02:00
Allan Odgaard
fd4395c2bf Use document’s “logical path” to lookup preferred encoding 2016-07-06 19:04:47 +02:00
Allan Odgaard
665ad94892 Document settings would not be read using document’s path
A document has both a virtual and an actual path. The virtual path is relevant e.g. when opening files via rmate, where we want to lookup file-type specific settings based on the remote path (filename) rather than the local temporary file. However, if there is no virtual path, we should fallback on the actual path, which broke when we made document_t a wrapper for OakDocument.

There is now a new logical_path getter which return the virtual path and fallback on the actual path.

Closes textmate/bugs#21
2016-07-06 16:46:07 +02:00
Allan Odgaard
6c73e4bbae Remove legacy open callback abstract base class 2016-07-05 22:58:22 +02:00
Allan Odgaard
ec430fe375 Don’t let layout_t rely on caller to set the theme’s font
The theme_t::copy_with_font_name_and_size is an implementation detail that would be nice to get rid of.
2016-07-05 12:13:05 +02:00
Allan Odgaard
823313d276 Add some assertions 2016-06-30 22:37:18 +02:00