The NSImageNameRemoveTemplate looks bad in 10.14, and while there is some duplication in this commit, it’s so few lines that sharing this functionality would result in an increase of total number of lines.
This is to avoid issues with AppKit when changing OakChooser to be a subclass of NSWindowController, as NSWindowController already has a document property and makes some assumptions about this.
I picked TMDocument over oakDocument only because I wasn’t sure how to capitalize the latter for getter/setter.
On 10.14 we use the “behind window” blending mode as we’d prefer the background to differ from that of the text view itself, though I am not seeing much of a difference here.
This is limited to hidden items that have a key equivalent assigned to them, although if they don’t, there is probably no harm in enabling this option.
This makes the title bar render in the same color as it did prior to building on 10.14, so that the current tab colors match.
It does however make sheets appear from “above” the title bar and makes the Dark Mode style darker, so this is just an intermediate fix until the tab bar gets revamped for 10.14.
On macOS 10.14 this image doesn’t always render, so this is a temporary workaround.
The main advantage of using OakFileIconImage is the added SCM badge and custom icon for known file types.
The purpose was to render text with a shadow and fade the text when the window is inactive, but the former has not been used since 10.10 and the latter doesn’t actually seem to work.
Not too fond of how this looks in Dark Mode but I think it’s better than the previous colors, which stem from back when the window had more of a 3D look.
When building on 10.14 the textured window look does not provide a borderless title bar look as the window content is lighter than the title bar.
The solution is to move the search controls to the title bar, which is possible starting with 10.10.
Ideally I would like to have the FileItem class be the public API, as that will then take care of updating the icon’s SCM status etc., current commit is just a temporary fix for missing document icons on 10.14.
When we observe a change on disk we will fetch status after 0.5 seconds if we are active, otherwise 3 seconds.
If we become active and have a pending update, we update immediately.
The reason for the delay is that the change on disk could be the version control system working, for example performing a rebase, and not all systems can gracefully handle requesting status when in the midst of such operation.
Since observers of NSUserDefaultsDidChangeNotification will be called from the thread that triggered the change, we should only update user defaults from the main thread.
OakSyntaxFormatter now applies background colors only when they do not match the theme's global background color. The old behavior drew the background all the time, which looked off when drawing formatted text in the Find History list. This effect is made especially apparent by macOS 10.14's translucent combo boxes, and now that they're used for history in the Find dialog, this needed to be fixed.