Skip to content

Commit 87a6dfb

Browse files
committed
Release 2.1.0 with macOS Monterey optimisation, support for plain files and VCS plugin.
1 parent b18f3ff commit 87a6dfb

File tree

84 files changed

+5476
-701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+5476
-701
lines changed

.gitmodules

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
[submodule "highlight-wrapper/highlight"]
22
path = highlight-wrapper/highlight
3-
url = https://gitlab.com/saalen/highlight.git
3+
url = https://gitlab.com/sbarex/highlight.git
4+
ignore = dirty
5+
branch = master

Application/AboutViewController.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ hr {
136136
NSWorkspace.shared.open(url)
137137
decisionHandler(.cancel)
138138
} else {
139-
print("Open it locally")
139+
// print("Open it locally")
140140
decisionHandler(.allow)
141141
}
142142
} else {
143-
print("not a user click")
143+
// print("not a user click")
144144
decisionHandler(.allow)
145145
}
146146
}
@@ -150,7 +150,7 @@ hr {
150150
view.window?.standardWindowButton(.zoomButton)?.isHidden = true
151151
view.window?.standardWindowButton(.miniaturizeButton)?.isHidden = true
152152
view.window?.titlebarAppearsTransparent = true
153-
if #available(OSX 11.0, *) {
153+
if #available(macOS 11.0, *) {
154154
view.window?.toolbarStyle = .unifiedCompact
155155
view.window?.titlebarSeparatorStyle = .none
156156
}

Application/AppDelegate.swift

+30-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
6363
}
6464

6565
// Insert code here to initialize your application
66-
if #available(OSX 10.12.2, *) {
66+
if #available(macOS 10.12.2, *) {
6767
NSApplication.shared.isAutomaticCustomizeTouchBarMenuItemEnabled = true
6868
}
6969

@@ -140,6 +140,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
140140

141141
var fileTypes: [UTI] = []
142142
for type in supportedTypes {
143+
guard !Settings.plainUTIs.contains(type) else {
144+
continue
145+
}
143146
let uti = UTI(type)
144147
if uti.isValid {
145148
fileTypes.append(uti)
@@ -222,5 +225,31 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
222225
}
223226
})
224227
}
228+
229+
class func initSyntaxPopup(_ popupButton: NSPopUpButton?, availableSyntax: [String: HighlightWrapper.Language], extraItems extra: [String] = []) {
230+
guard let popupButton = popupButton else {
231+
return
232+
}
233+
popupButton.removeAllItems()
234+
for item in extra {
235+
popupButton.addItem(withTitle: item)
236+
}
237+
238+
guard availableSyntax.count > 0 else {
239+
return
240+
}
241+
if !extra.isEmpty {
242+
popupButton.menu?.addItem(NSMenuItem.separator())
243+
}
244+
let keys = availableSyntax.keys.sorted{$0.compare($1, options: .caseInsensitive) == .orderedAscending }
245+
for desc in keys {
246+
let m = NSMenuItem(title: desc, action: nil, keyEquivalent: "")
247+
m.toolTip = desc
248+
if let lang = availableSyntax[desc] {
249+
m.toolTip! += " [." + lang.extensions.joined(separator: ", .") + "]"
250+
}
251+
popupButton.menu?.addItem(m)
252+
}
253+
}
225254
}
226255

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "aA.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"preserves-vector-representation" : true,
14+
"template-rendering-intent" : "template"
15+
}
16+
}
145 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "doc.plaintext.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"preserves-vector-representation" : true,
14+
"template-rendering-intent" : "template"
15+
}
16+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "re.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"preserves-vector-representation" : true,
14+
"template-rendering-intent" : "template"
15+
}
16+
}
142 KB
Binary file not shown.

Application/CustomTypeViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class CustomTypeViewController: NSViewController, DropSensorDelegate, NSTableVie
295295
view.imageView?.toolTip = "Not supported."
296296
case .highlight:
297297
view.imageView?.image = NSImage(named: NSImage.statusPartiallyAvailableName)
298-
view.imageView?.toolTip = "Supported but not handled."
298+
view.imageView?.toolTip = "Potentially supported but not handled."
299299
case .unknown:
300300
view.imageView?.image = NSImage(named: NSImage.statusNoneName)
301301
view.imageView?.toolTip = "Unknown status."

Application/HighlightWrapper.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ class HighlightWrapper {
8989
}
9090

9191
for i in 0 ..< Int(n) {
92-
let t = c_themes.advanced(by: i).pointee!.pointee
92+
guard let t = c_themes.advanced(by: i).pointee?.pointee else {
93+
continue
94+
}
9395

9496
highlight_get_theme(t.path, context, Themes.callback)
9597
}
@@ -409,7 +411,9 @@ class HighlightWrapper {
409411
let plugins = Unmanaged<Plugins>.fromOpaque(context!).takeUnretainedValue()
410412

411413
for i in 0 ..< Int(n) {
412-
let p = c_plugins.advanced(by: i).pointee!.pointee
414+
guard let p = c_plugins.advanced(by: i).pointee?.pointee else {
415+
continue
416+
}
413417
plugins.plugins.append(Plugin(name: String(cString: p.name), desc: String(cString: p.desc), path: String(cString: p.path)))
414418
}
415419
}

Application/Info.plist

+43-2
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,24 @@
299299
</array>
300300
</dict>
301301
</dict>
302+
<dict>
303+
<key>UTTypeConformsTo</key>
304+
<array>
305+
<string>dyn.ah62d4rv4ge81u5pu</string>
306+
<string>public.data</string>
307+
</array>
308+
<key>UTTypeDescription</key>
309+
<string>Adobe Extensible Metadata Platform file (XMP)</string>
310+
<key>UTTypeIdentifier</key>
311+
<string>com.seriflabs.xmp</string>
312+
<key>UTTypeTagSpecification</key>
313+
<dict>
314+
<key>public.filename-extension</key>
315+
<array>
316+
<string>xmp</string>
317+
</array>
318+
</dict>
319+
</dict>
302320
<dict>
303321
<key>UTTypeConformsTo</key>
304322
<array>
@@ -350,6 +368,24 @@
350368
</array>
351369
</dict>
352370
</dict>
371+
<dict>
372+
<key>UTTypeConformsTo</key>
373+
<array>
374+
<string>public.item</string>
375+
<string>dyn.ah62d4rv4ge81g7xfrv4gn</string>
376+
</array>
377+
<key>UTTypeDescription</key>
378+
<string>Svelte source file</string>
379+
<key>UTTypeIdentifier</key>
380+
<string>dev.svelte.source</string>
381+
<key>UTTypeTagSpecification</key>
382+
<dict>
383+
<key>public.filename-extension</key>
384+
<array>
385+
<string>svelte</string>
386+
</array>
387+
</dict>
388+
</dict>
353389
<dict>
354390
<key>UTTypeConformsTo</key>
355391
<array>
@@ -672,6 +708,11 @@
672708
<key>UTTypeConformsTo</key>
673709
<array>
674710
<string>public.source-code</string>
711+
<string>public.plain-text</string>
712+
<string>public.text</string>
713+
<string>public.data</string>
714+
<string>public.item</string>
715+
<string>public.content</string>
675716
<string>dyn.ah62d4rv4ge80s52</string>
676717
</array>
677718
<key>UTTypeDescription</key>
@@ -1224,13 +1265,13 @@
12241265
</dict>
12251266
</dict>
12261267
<dict>
1227-
<key>UTTypeDescription</key>
1228-
<string>Outline Processor Markup Language (OPML) file</string>
12291268
<key>UTTypeConformsTo</key>
12301269
<array>
12311270
<string>public.item</string>
12321271
<string>dyn.ah62d4rv4ge8086drru</string>
12331272
</array>
1273+
<key>UTTypeDescription</key>
1274+
<string>Outline Processor Markup Language (OPML) file</string>
12341275
<key>UTTypeIdentifier</key>
12351276
<string>org.opml.source</string>
12361277
<key>UTTypeTagSpecification</key>

Application/LSPViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ class BrowseCell: NSTableCellView, NSTextFieldDelegate {
540540
openPanel.canCreateDirectories = false
541541
openPanel.showsTagField = false
542542
openPanel.allowsOtherFileTypes = true
543-
if #available(OSX 11.0, *) {
543+
if #available(macOS 11.0, *) {
544544
openPanel.allowedContentTypes = [UTType.script, UTType.shellScript, UTType.executable, UTType.unixExecutable]
545545
} else {
546546
openPanel.allowedFileTypes = ["public.script", "public.shell-script", "public.executable", "public.unix-executable"]

0 commit comments

Comments
 (0)