Commit Graph

562 Commits

Author SHA1 Message Date
Allan Odgaard
c0d6967480 Let OakTextView store an OakDocument instance instead of document_t 2016-08-28 17:23:05 +02:00
Allan Odgaard
9d48b5683b Don’t let OakTextView use any of the document_t wrapper methods 2016-08-28 17:22:06 +02:00
Allan Odgaard
c942dde920 Only use OakDocument in document_view_t
Also change indent property to tab_size and soft_tabs.
2016-08-28 17:20:08 +02:00
Allan Odgaard
ba8dfaf9fd Remove some unused document::run delegate methods 2016-08-28 13:32:49 +02:00
Allan Odgaard
15d4f6c122 Use executeBundleCommand:variables: in editor_t’s command runner 2016-08-28 13:32:49 +02:00
Allan Odgaard
350db382d9 Use executeBundleCommand:variables: in performBundleItem: 2016-08-28 13:32:49 +02:00
Allan Odgaard
5783cceac7 Use executeBundleCommand:variables: in dropFiles: 2016-08-28 13:32:49 +02:00
Allan Odgaard
991822635f Use executeBundleCommand:variables: in filterDocumentThroughCommand: 2016-08-28 13:32:49 +02:00
Allan Odgaard
24a133d5a5 Add executeBundleCommand:variables: to OakTextView (internal API) 2016-08-28 13:32:48 +02:00
Allan Odgaard
f01bf97630 Add OakCommand responder methods to OakTextView and DocumentController 2016-08-28 13:32:48 +02:00
Allan Odgaard
60ba4c9930 Introduce callback.document.will/did-reload 2016-08-28 09:11:34 +02:00
Allan Odgaard
7ae00f9436 Ensure we have a selection before local drag’n’drop (move)
Based on crash reports it would appear that users are able to trigger a local drag’n’drop (move) even when there is no selection.
2016-08-25 09:41:21 +02:00
Allan Odgaard
b97a3fc3f8 More crash report info related to drag’n’drop issue 2016-08-25 09:41:21 +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
c488d25555 Add support for rendering strikethrough text 2016-08-24 21:22:26 +02:00
Allan Odgaard
0663b21025 Use symbolic name for kCTUnderlineStyleSingle 2016-08-24 21:14:02 +02:00
Allan Odgaard
196db13f1d Do not accept dropped text of type public.plain-text
The stringForType: method seems unable to handle this type, as a textClipping file dragged to TextMate (on 10.11) will result in a string with null bytes, presumably because the data was UTF-16 but interpreted as ASCII / MacRoman.

This change mirrors what we did for services in commit 062a939189
2016-08-21 12:09:32 +02:00
Allan Odgaard
dbdfa3c6af Add identifying information to perror output 2016-08-21 12:09:30 +02:00
Allan Odgaard
39bea0af08 Do not try to detect when font creation fails
Some users manually set their font to “Anonymous Pro”, “DejaVu Sans Mono”, or similar, where the created font will use a name without the spaces, so TextMate would consider this a failure and fallback to the system default (monospace) font.

This partially reverts commit 7e69201513.
2016-08-17 15:23:05 +02:00
Ronald Wampler
4c1f8a18fb Use weak storage for GutterView's partnerView
On 10.12 beta 3, when closing a window, the following exception is thrown:

Exception Name: NSInternalInconsistencyException
Description: <GutterView 0x7fa71c511150> has reached dealloc but still has a super view. Super views strongly reference there children, so this is being over-released, or has been over-released in the past.

Despite the mention of our GutterView instance being over-released, the actual problem is that we do not call super in our override of `removeFromSuperView`, where we nil out our partner view. A simple fix to avoid crashing would be just calling super in that method so that the view is marked as being removed; however, we can simplify the code and eliminate the need to override our super's method by using a weak reference instead and let ARC automatically handle the zeroing of our partner view.
2016-07-21 15:55:01 -04:00
Allan Odgaard
866136fe83 Add more (crash reports) debug info when dragging text 2016-07-16 13:40:33 +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
417706400d Remove document_t from refresh helper 2016-07-16 13:13:45 +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
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
bd3acf8e96 Pass lambda (to run commands) to editor_t instead of document_t 2016-07-16 13:13:43 +02:00
Allan Odgaard
d9a9fd34bc Use OakDocumentEditor instead of ng::editor_for_document 2016-07-16 13:13:43 +02:00
Allan Odgaard
8acc2be710 Remove unnecessary references to ‘document’ instance variable 2016-07-14 12:22:44 +02:00
Allan Odgaard
8affd6234f Move clipboard wrapper to (new) OakDocument framework
Ideally we would stay in the document framework, but the editor framework currently depends on our document framework and we want to introduce a OakDocumentEditor which encapsulates an editor and layout instance, so to avoid cyclic dependencies we are doing this as a new framework.

Once the last document dependencies have been removed from the editor framework, we can merge OakDocument and OakDocumentEditor.
2016-07-14 12:22:44 +02:00
Allan Odgaard
d25f6aa6cb Pass document_t to macro and execute_dispatch member functions
This way the editor_t instance no longer require a reference to a document instance.
2016-07-14 12:22:44 +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
Ronald Wampler
69b7b8ee42 Use non-deprecated method to load nib (10.8)
We can pass `NULL` to `topLevelObjects` since we have a strong IBOutlet to the NSPanel (our top-level object).
2016-07-07 08:56:59 +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
36e01eeb10 Fail early if OakDocumentView / OakTextView lack a document
There are still methods that will fail (crash) when we lack a document, but everything involved with constructing and displaying the view should not work even without a placeholder document.
2016-07-05 17:07:33 +02:00
Allan Odgaard
dff96aba21 Lookup theme per document type
This allows setting different themes for different document types or paths (closes #801).
2016-07-05 15:31:19 +02:00
Allan Odgaard
f8b2ca4da4 Don’t make OakTextView’s theme property a const reference
At the same time use dot-notation to access the property.
2016-07-05 15:11:57 +02:00
Allan Odgaard
b6f5474629 Fail early for some OakTextView methods when we have no theme 2016-07-05 14:58:23 +02:00
Allan Odgaard
0bb275b4f0 Rely on the system’s default monospaced font rather than Menlo
Furthermore, if the user changes to the default monospaced font then we do not store its name in settings (given that it’s default).
2016-07-05 12:13:06 +02:00
Allan Odgaard
7e69201513 Use default monospace font when failing to get requested font
If we ask for a non-existing font then we may get back the system default font and as most users expect a monospaced font, we take extra steps to catch this situation and switch to the default monospaced font.

For example users that are currently using Menlo may get into this situation on macOS 10.12 where Menlo has been removed.

Furthermore, when no font name is configured we also use the system’s default fixed width font.
2016-07-05 12:13:06 +02:00
Allan Odgaard
58aafa283d Let OakTextView store an NSFont instead of separate font name and size 2016-07-05 12:13:06 +02:00
Allan Odgaard
a337d6029c Remove use of copy_with_font_name_and_size from OakTextView 2016-07-05 12:13:06 +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
1afd1f11ba Use weak storage for OakTextView’s delegate (10.8)
Prior to 10.8 we could not form weak references to NSWindowControllers and as a delegate’s superclass is unknown, and could very likely be a window controller, we could not use weak storage.
2016-07-05 10:15:07 +02:00
Allan Odgaard
94036f28aa Non-active text views only execute bundle items with ⌘ in their shortcut
In general only the active view should respond to keys but we have the text view handle bundle items because they can provide actions that are not tied to text editing, for example “Build” or “Show SCM Actions”.

Ideally bundle items would (also) be handled by the window controller, but keyDown: is not commonly passed up the responder chain, so our window controller never sees any keys.

The way the system is designed is that the menu system will resolve keys (before the active view) and then send the menu item’s action up the responder chain, so views respond to actions rather than keys, but we cannot use this system for bundle items because it does not support multiple items with same key equivalent or scope selectors.
2016-07-03 20:34:41 +02:00
Allan Odgaard
3ff9a5dfee Don’t go via buffer_t to remove document marks
The document will post a “marks did change” notification, so we can remove our local notification posting.
2016-06-30 22:48:40 +02:00
Allan Odgaard
1bc09c2ee7 Don’t go through buffer_t to get document’s indent settings 2016-06-30 22:48:17 +02:00
Allan Odgaard
61492af33c Fix typo 2016-06-30 15:25:46 +02:00
Allan Odgaard
bcae1a8aa1 Move printing support to OakDocument 2016-06-29 11:37:28 +02:00