Commit Graph

231 Commits

Author SHA1 Message Date
Allan Odgaard
6bc27b8511 Handle begin/end undo grouping for document w/o document editor
Previously this would be a no-op basically bringing the undo stack out of sync and making TextMate prone to crashing.

We create an undo group when reloading document changes and here we do not create a document editor, hence when this happened for unselected tabs (which currently have no document editor), the undo stack was brought out of sync.
2016-08-30 09:15:17 +02:00
Allan Odgaard
b0c77ff656 Fix minor whitespace issues 2016-08-29 12:44:15 +02:00
Allan Odgaard
2b3f0734d5 Use path::rename_or_copy for backups 2016-08-29 07:50:19 +02:00
Allan Odgaard
46fb745bbe Use perrorf when printing errors with dynamic strings
Also revise error messages to be more consistent.
2016-08-28 17:25:26 +02:00
Allan Odgaard
c78473dc6c Make OakDocument’s visibleIndex and selection properties public 2016-08-28 17:21:35 +02:00
Allan Odgaard
0153e837a8 Remove document::run API 2016-08-28 13:32:49 +02:00
Allan Odgaard
0638874b61 Tag code that can be retired when updating OS requirement
When bumping the minimum requirement we can do a search for MAC_OS_X to find all places where we have compatibility code.
2016-08-28 09:13:33 +02:00
Allan Odgaard
0e963bafc1 Post will/did reload document notifications 2016-08-28 09:10:28 +02:00
Allan Odgaard
f9e02d9fdc Allow setting fontName and fontSize differently for each document
Previously we would read these values when creating the OakTextView so they would be used for all document types. Now they are re-read each time we change document, so it’s possible to have different fonts for different documents based on type or location.
2016-08-24 22:26:47 +02:00
Allan Odgaard
dbdfa3c6af Add identifying information to perror output 2016-08-21 12:09:30 +02:00
Allan Odgaard
ba58c25afc Replacing in a document with no document editor would be a no-op
Documents loaded in background tabs do not currently have a document editor, so doing Find (in folder) → Replace All would effectively skip all inactive tabs (with loaded content).
2016-08-18 17:51:18 +02:00
Allan Odgaard
17a08d2c54 Do not call sync_open on a document which is loading
A document which is loading is likely showing a modal dialog (encoding view) and calling sync_open will run a local event loop which may then lock up the UI.
2016-08-17 15:23:05 +02:00
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