Commit Graph

3673 Commits

Author SHA1 Message Date
Allan Odgaard
adf8f89547 WIP: Add ability to re-run commands on document events 2016-09-29 11:20:11 +02:00
Allan Odgaard
2c54e2eedf Expose OakCommand’s underlying bundle_command_t
This is to access the auto refresh and input fields.

Maybe the two types should be merged into one.
2016-09-29 09:56:50 +02:00
Allan Odgaard
d929327d34 Revert "Use thread_local instead of our own implementation"
This reverts commit 1658d6356a.
2016-09-29 09:56:50 +02:00
Allan Odgaard
fee5bd3f1f Add syntax highlight to pasteboard search history
This is just a quick proof-of-concept.
2016-09-29 09:56:50 +02:00
Allan Odgaard
9f889f9e6a Remove document_t and related tests
Tests should be ported to OakDocument.
2016-09-29 09:56:50 +02:00
Allan Odgaard
380f9a308a Let OakDocument use OakSourceControlManager 2016-09-29 09:56:50 +02:00
Allan Odgaard
997bd7c193 WIP: Add OakSourceControlManager 2016-09-29 09:56:50 +02:00
Allan Odgaard
e6f4f2dc40 Use atomic getter/setter to access lastDocumentPath
There was a race-condition since we update it in the background queue, where it could be released, and using it in the main queue does not retain it before use.
2016-09-29 09:56:50 +02:00
Allan Odgaard
e446e1d98b Account for NSString creation failure
This can happen if the range is not valid unicode, although that would indicate another issue, but as we do a subset match against a unicode string, in UTF-8, I am thinking it might be about combining marks or similar, so we split the string between a glyph and the following combining mark, and NSString consider a string starting with a combining mark invalid, but this is just a wild guess…
2016-09-29 09:56:50 +02:00
Allan Odgaard
b514f9c6aa Support passing nil to CanonicalURL 2016-09-29 09:56:50 +02:00
Allan Odgaard
4a260811ec Change URL scheme to https 2016-09-29 09:56:50 +02:00
Allan Odgaard
0fb5050cfe Support NSNotFound in performCloseTab:
The tab bar uses the result of indexOfObject: as the tag, so if there is no selected tab, it would be NSNotFound.

Generally though this should not happen.
2016-09-29 09:56:49 +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
db6c22bd8c Delegate menu item validation for performBundleItemWithUUIDStringFrom:
We now let the object that handles performBundleItem: validate the menu item.
2016-09-29 09:16:00 +02:00
Allan Odgaard
9e8a435e2b Change how we manage window title updates
We now only “reveal file in project” (when enabled) on document path changes.
2016-09-28 20:56:55 +02:00
Allan Odgaard
e59b023119 Post OakDocumentContentDidChangeNotification for all buffer changes 2016-09-28 20:56:55 +02:00
Allan Odgaard
3b2a075808 Add public htmlOutputView property to OakCommand 2016-09-27 21:51:55 +02:00
Allan Odgaard
ce55f5691e Add public closeHTMLOutputView method to OakCommand 2016-09-27 21:51:55 +02:00
Allan Odgaard
d7f06c70c6 Don’t check requirements or new HTML output view when reusing OakCommand 2016-09-27 21:51:55 +02:00
Allan Odgaard
010bb72375 Add ‘visible’ property to OakHTMLOutputView
This can be observed to learn when the view is hidden, either because the window it is in closes or when it is removed from its superview.
2016-09-27 21:51:55 +02:00
Allan Odgaard
09534b7ffc Use NSWorkspace API instead of LSGetApplicationForURL 2016-09-27 21:49:32 +02:00
Allan Odgaard
406a804a3e Remove redundant intrinsicContentSize overload 2016-09-27 21:49:32 +02:00
Allan Odgaard
330c434a73 Check for nil before messaging object
This shouldn’t be necessary but many of the new crashes on macOS 10.12 are from this method, though I suspect that ‘self’ is the already released object rather than ‘otherObject’ being nil.
2016-09-27 21:49:32 +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
f0a2a70998 Change ‘isBusy’ setter to just ‘busy’
The getter is still ‘isBusy’.
2016-09-27 21:49:32 +02:00
Allan Odgaard
ecee5e62e3 Add updateHTMLViewAtomically property to OakCommand
This can be used to refresh the output from a command that is already visible (to avoid flicker and resetting scroll position).
2016-09-27 21:36:26 +02:00
Allan Odgaard
3cf916cf49 Rename loadHTMLString: method to setContent:
The previous name was inspired by WebView’s default API but it sounds like it is just the default implementation with a default baseURL: parameter, hence why I prefer to name it something different.
2016-09-27 21:36:26 +02:00
Allan Odgaard
8e9cd68c4f Refactor handling of HTML output in OakCommand
Setup and teardown is now contained in the same method.
2016-09-27 21:36:26 +02:00
Allan Odgaard
4dea28811c Let OakTextView run modal event loop waiting for command 2016-09-27 21:34:55 +02:00
Allan Odgaard
bf2eb3eb83 Add terminationHandler property and terminate method to OakCommand 2016-09-27 21:29:03 +02:00
Allan Odgaard
ede6b4b026 Change named parameter completionHandler: to outputHandler:
The handler is only called for commands with output to insert into the text view, hence completionHandler is a misnomer.
2016-09-27 21:29:03 +02:00
Allan Odgaard
3c150d34aa Ensure we only remove observer that we previously added
We were previously assuming that the viewWillMoveToSuperview: was only called when moving to a view and then later when removed, but for 10.8.5 it appears that it might be called multiple times (with a nil superview), causing us to remove ourself as observer from something we didn’t observe.
2016-09-26 21:01:04 +02:00
Allan Odgaard
b0d2a93040 Fix placement of search results checkboxes 2016-09-26 11:14:23 +02:00
Allan Odgaard
796a879452 Use objectsAtIndexes: instead of iterating index set 2016-09-26 11:14:14 +02:00
Allan Odgaard
e286df09e6 fixup! Avoid wrapper objects in FileChooser 2016-09-26 11:13:06 +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
9e949e3eda Use NSUUID for project identifier (instead of NSString) 2016-09-26 11:08:22 +02:00
Allan Odgaard
de92b7dbe9 Provide to_s for NSUUID 2016-09-26 11:07:56 +02:00
Allan Odgaard
d5fad16311 Dragging selected tab to new window will select it in the new window 2016-09-26 11:06:52 +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
b1f92d1415 Skip work when regular expression property is set to its existing value 2016-09-26 08:09:58 +02:00
Allan Odgaard
12ca096ccb Enable syntax highlight for find and replace text fields
These use the source.regexp.oniguruma and textmate.format-string grammars respectively, both in the TextMate bundle.
2016-09-26 08:09:58 +02:00
Allan Odgaard
b5d897315c Add ${«var»:/titlecase} as alias for ${«var»:/capitalize} 2016-09-25 13:08:21 +02:00
Allan Odgaard
7f42f439b7 Add NSFormatter subclass that does syntax highlight
The theme used can be set using the UIThemeUUID defaults key. The default is Mac Classic.
2016-09-25 13:08:21 +02:00
Allan Odgaard
5a571ad036 Fix leak: CGPathRef 2016-09-25 07:31:13 +02:00
Allan Odgaard
973e38a383 Fix leak: buffer_callback_t 2016-09-25 07:31:13 +02:00
Allan Odgaard
b56c51212a Check for exact dependencies when updating icon/represented file 2016-09-24 15:21:02 +02:00
Allan Odgaard
8cab8be8b5 Also observe document’s display name
The display name can change without a change to the path, in which case, we should update the UI accordingly, although the current implementation of OakDocument does not trigger any change notification when e.g. the user enables “Hide Extension” for a document.
2016-09-24 15:21:02 +02:00