1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-26 23:36:08 +03:00

Merge branch 'master' of github.com:qvacua/vimr

This commit is contained in:
George Harker 2023-11-14 15:43:21 -08:00
commit 6ebb94b97a
31 changed files with 83 additions and 283 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "Neovim"]
path = Neovim
url = git@github.com:qvacua/neovim.git
url = https://github.com/neovim/neovim.git

2
Neovim

@ -1 +1 @@
Subproject commit 4a6024b465fee813066b34dc620ff1e7000424c1
Subproject commit 48bcc7b9710d6db619b05254ea87f4087cdd9764

View File

@ -1 +0,0 @@
../../NvimServerTypes/Sources/include/NvimServerTypes.h

View File

@ -1 +0,0 @@
../../../Neovim/src/nvim/main.c

View File

@ -10,7 +10,7 @@ build_neovim() {
# Brew's gettext does not get sym-linked to PATH
export PATH="/opt/homebrew/opt/gettext/bin:/usr/local/opt/gettext/bin:${PATH}"
export MACOSX_DEPLOYMENT_TARGET
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
cmake -S cmake.deps -B .deps -G Ninja \
@ -19,11 +19,18 @@ build_neovim() {
-D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \
-D CMAKE_FIND_FRAMEWORK=NEVER
cmake --build .deps
# See https://matrix.to/#/!cylwlNXSwagQmZSkzs:matrix.org/$WxndooGmUtD0a4IqjnALvZ_okHw3Gb0TZJIrc77T-SM?via=matrix.org&via=gitter.im&via=envs.net for libintl
cmake -B build -G Ninja \
-D CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} \
-D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \
-D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \
-D CMAKE_FIND_FRAMEWORK=NEVER
-D CMAKE_FIND_FRAMEWORK=NEVER \
-D LIBINTL_INCLUDE_DIR=../NvimServer/NvimServer/third-party/gettext/include \
-D LIBINTL_LIBRARY=../NvimServer/NvimServer/third-party/gettext/lib/libintl.a
cmake --build build
cmake --build build
cpack --config build/CPackConfig.cmake
}

View File

@ -23,7 +23,7 @@ main() {
local version; version=$(brew info gettext --json | jq -r ".[0].versions.stable"); readonly version
echo "### gettext version ${version}"
local temp_dir; temp_dir="$(mktemp -d)"; readonly temp_dir
echo "${temp_dir}"
@ -39,9 +39,15 @@ main() {
popd >/dev/null
mkdir universal
cp -r "${arm64_bottle}/gettext/${version}/include" ./universal/
#cp -r "${arm64_bottle}/gettext/${version}/include" ./universal/
mkdir universal/lib
lipo "${arm64_bottle}/gettext/${version}/lib/libintl.a" "${x86_64_bottle}/gettext/${version}/lib/libintl.a" -create -output ./universal/lib/libintl.a
pushd ./universal >/dev/null
ln -s /opt/homebrew/opt/gettext/bin .
ln -s /opt/homebrew/opt/gettext/share .
ln -s /opt/homebrew/opt/gettext/include .
popd >/dev/null
popd >/dev/null
mv "${temp_dir}/universal" gettext

View File

@ -1,76 +0,0 @@
/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
#ifndef NVIMSERVER_SHARED_TYPES_H
#define NVIMSERVER_SHARED_TYPES_H
#include <CoreFoundation/CoreFoundation.h>
#define NSInteger long
#define NSUInteger unsigned long
typedef CF_OPTIONS(NSUInteger, FontTrait) {
FontTraitNone = 0,
FontTraitItalic = (1 << 0),
FontTraitBold = (1 << 1),
FontTraitUnderline = (1 << 2),
FontTraitUndercurl = (1 << 3)
};
typedef CF_ENUM(NSInteger, RenderDataType) {
RenderDataTypeRawLine,
RenderDataTypeGoto,
RenderDataTypeScroll,
};
typedef CF_ENUM(NSInteger, NvimServerMsgId) {
NvimServerMsgIdServerReady = 0,
NvimServerMsgIdNvimReady,
NvimServerMsgIdResize,
NvimServerMsgIdClear,
NvimServerMsgIdSetMenu,
NvimServerMsgIdBusyStart,
NvimServerMsgIdBusyStop,
NvimServerMsgIdModeChange,
NvimServerMsgIdModeInfoSet,
NvimServerMsgIdBell,
NvimServerMsgIdVisualBell,
NvimServerMsgIdFlush,
NvimServerMsgIdHighlightAttrs,
NvimServerMsgIdSetTitle,
NvimServerMsgIdStop,
NvimServerMsgIdOptionSet,
NvimServerMsgIdEvent,
NvimServerMsgIdDirtyStatusChanged,
NvimServerMsgIdCwdChanged,
NvimServerMsgIdColorSchemeChanged,
NvimServerMsgIdDefaultColorsChanged,
NvimServerMsgIdAutoCommandEvent,
NvimServerMsgIdRpcEventSubscribed,
NvimServerMsgIdFatalError,
NvimServerMsgIdDebug1,
};
typedef CF_ENUM(NSInteger, NvimServerFatalErrorCode) {
NvimServerFatalErrorCodeLocalPort = 1,
NvimServerFatalErrorCodeRemotePort,
};
typedef CF_ENUM(NSInteger, NvimBridgeMsgId) {
NvimBridgeMsgIdAgentReady = 0,
NvimBridgeMsgIdReadyForRpcEvents,
NvimBridgeMsgIdDeleteInput,
NvimBridgeMsgIdResize,
NvimBridgeMsgIdScroll,
NvimBridgeMsgIdFocusGained,
NvimBridgeMsgIdDebug1,
};
#endif // NVIMSERVER_SHARED_TYPES_H

View File

@ -1,6 +0,0 @@
/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
// SwiftPM requires at least one c source file, which can be empty.

View File

@ -1,13 +0,0 @@
// swift-tools-version:5.7
import PackageDescription
let package = Package(
name: "NvimServer",
platforms: [.macOS(.v13)],
products: [
.library(name: "NvimServerTypes", targets: ["NvimServerTypes"]),
],
dependencies: [],
targets: [.target(name: "NvimServerTypes", dependencies: [], path: "NvimServerTypes")]
)

View File

@ -1,4 +0,0 @@
# NvimServerTypes
This is a package to provider some types of NvimServer that are used in NvimView.
It consists of just one header file. Since SwiftPM requires at least a C file, we included an empty C file.

View File

@ -1,77 +0,0 @@
{
"pins" : [
{
"identity" : "bluesocket",
"kind" : "remoteSourceControl",
"location" : "https://github.com/IBM-Swift/BlueSocket",
"state" : {
"revision" : "7b23a867008e0027bfd6f4d398d44720707bc8ca",
"version" : "2.0.4"
}
},
{
"identity" : "cwlcatchexception",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattgallagher/CwlCatchException.git",
"state" : {
"revision" : "35f9e770f54ce62dd8526470f14c6e137cef3eea",
"version" : "2.1.1"
}
},
{
"identity" : "cwlpreconditiontesting",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattgallagher/CwlPreconditionTesting.git",
"state" : {
"revision" : "c21f7bab5ca8eee0a9998bbd17ca1d0eb45d4688",
"version" : "2.1.0"
}
},
{
"identity" : "material-icons",
"kind" : "remoteSourceControl",
"location" : "https://github.com/qvacua/material-icons",
"state" : {
"revision" : "c3db645060fd27df5f7e0a9873c2af22c280725e",
"version" : "0.1.0"
}
},
{
"identity" : "messagepack.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/a2/MessagePack.swift",
"state" : {
"revision" : "27b35fd49e92fcae395bf8ccb233499d89cc7890",
"version" : "4.0.0"
}
},
{
"identity" : "nimble",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Quick/Nimble",
"state" : {
"revision" : "b7f6c49acdb247e3158198c5448b38c3cc595533",
"version" : "11.2.1"
}
},
{
"identity" : "purelayout",
"kind" : "remoteSourceControl",
"location" : "https://github.com/PureLayout/PureLayout",
"state" : {
"revision" : "5561683c96dc49b023c1299bfe4f6fbeed5f8199",
"version" : "3.1.9"
}
},
{
"identity" : "rxswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ReactiveX/RxSwift",
"state" : {
"revision" : "b4307ba0b6425c0ba4178e138799946c3da594f8",
"version" : "6.5.0"
}
}
],
"version" : 2
}

View File

@ -13,7 +13,6 @@ let package = Package(
.package(url: "https://github.com/a2/MessagePack.swift", from: "4.0.0"),
.package(url: "https://github.com/ReactiveX/RxSwift", from: "6.6.0"),
.package(url: "https://github.com/Quick/Nimble", from: "13.0.0"),
.package(name: "NvimServer", path: "../NvimServer"),
.package(name: "Commons", path: "../Commons"),
.package(name: "Tabs", path: "../Tabs"),
],
@ -25,7 +24,6 @@ let package = Package(
.product(name: "RxPack", package: "RxPack"),
"Tabs",
.product(name: "RxNeovim", package: "RxPack"),
.product(name: "NvimServerTypes", package: "NvimServer"),
.product(name: "MessagePack", package: "MessagePack.swift"),
"Commons",
],

View File

@ -4,7 +4,6 @@
*/
import Cocoa
import NvimServerTypes
final class AttributesRunDrawer {
var font: NSFont {

View File

@ -6,7 +6,6 @@
import Cocoa
import Commons
import MessagePack
import NvimServerTypes
public struct CellAttributes: CustomStringConvertible, Equatable {
public static func == (left: CellAttributes, right: CellAttributes) -> Bool {

View File

@ -5,7 +5,6 @@
import Cocoa
import Commons
import NvimServerTypes
private struct SizedFontTrait: Hashable {
static func == (lhs: SizedFontTrait, rhs: SizedFontTrait) -> Bool {

View File

@ -7,7 +7,6 @@ import Carbon
import Cocoa
import Foundation
import MessagePack
import NvimServerTypes
import os
import RxNeovim
import RxPack
@ -632,43 +631,6 @@ extension NvimView {
self.eventsSubject.onNext(.rpcEventSubscribed)
}
// FIXME: convert to subprocess
final func bridgeHasFatalError(_ value: MessagePackValue?) {
gui.async {
let alert = NSAlert()
alert.addButton(withTitle: "OK")
alert.messageText = "Error launching background neovim process"
alert.alertStyle = .critical
if let rawCode = value?.intValue,
let code = NvimServerFatalErrorCode(rawValue: rawCode)
{
switch code {
case .localPort:
alert.informativeText = "GUI could not connect to the background " +
"neovim process. The window will close."
case .remotePort:
alert.informativeText = "The remote message port could not " +
"connect to GUI. The window will close."
@unknown default:
self.log.error("Unknown fatal error from NvimServer")
}
} else {
alert.informativeText = "There was an unknown error launching the " +
"background neovim Process. " +
"The window will close."
}
alert.runModal()
self.queue.async {
self.eventsSubject.onNext(.neoVimStopped)
self.eventsSubject.onCompleted()
}
}
}
final func setAttr(with value: MessagePackValue) {
guard let array = value.arrayValue else {
self.bridgeLogger.error("Could not convert \(value)")

View File

@ -14,6 +14,18 @@ import RxSwift
import SpriteKit
import Tabs
import UniformTypeIdentifiers
import UserNotifications
public struct FontTrait: OptionSet {
public let rawValue: UInt
public init(rawValue: UInt) { self.rawValue = rawValue }
static let italic = FontTrait(rawValue: 1 << 0)
static let bold = FontTrait(rawValue: 1 << 1)
static let underline = FontTrait(rawValue: 1 << 2)
static let undercurl = FontTrait(rawValue: 1 << 3)
}
public enum FontSmoothing: String, Codable, CaseIterable {
case systemSetting
@ -28,6 +40,8 @@ public protocol NvimViewDelegate: AnyObject {
public final class NvimView: NSView, NSUserInterfaceValidations, NSTextInputClient {
// MARK: - Public
public static let rpcEventName = "com.qvacua.NvimView"
public static let minFontSize = 4.0
public static let maxFontSize = 128.0

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@ -23,11 +23,10 @@
4B0225F8224AAE260052362B /* Document.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B0225F6224AAE260052362B /* Document.xib */; };
4B0225FA224AAE270052362B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B0225F9224AAE270052362B /* Assets.xcassets */; };
4B0225FD224AAE270052362B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B0225FB224AAE270052362B /* MainMenu.xib */; };
4B0B364B25953BA100B06899 /* NvimServerTypes in Frameworks */ = {isa = PBXBuildFile; productRef = 4B0B364A25953BA100B06899 /* NvimServerTypes */; };
4B0B364F25953BEB00B06899 /* NvimView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0B364E25953BEB00B06899 /* NvimView.swift */; };
4B0B365325953CAC00B06899 /* NvimServerTypes in Frameworks */ = {isa = PBXBuildFile; productRef = 4B0B365225953CAC00B06899 /* NvimServerTypes */; };
4B0B365725953CDE00B06899 /* NvimView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0B365625953CDE00B06899 /* NvimView.swift */; };
4B0B365D25953D3D00B06899 /* NvimView in Frameworks */ = {isa = PBXBuildFile; productRef = 4B0B365C25953D3D00B06899 /* NvimView */; };
4B117B5D2B03FF91000DBFB4 /* FontTrait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD67CB124ED03B000147C51 /* FontTrait.swift */; };
4B90B6842775F0F400ACF552 /* KeyUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B90B6832775F0F400ACF552 /* KeyUtils.swift */; };
4B90B6852775F0F400ACF552 /* KeyUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B90B6832775F0F400ACF552 /* KeyUtils.swift */; };
4BD67C9924ECF53E00147C51 /* Commons in Frameworks */ = {isa = PBXBuildFile; productRef = 4BD67C7C24ECF35300147C51 /* Commons */; };
@ -126,7 +125,6 @@
buildActionMask = 2147483647;
files = (
4BD67CBB24ED03BF00147C51 /* Commons in Frameworks */,
4B0B365325953CAC00B06899 /* NvimServerTypes in Frameworks */,
4BD67CCA24ED042F00147C51 /* MessagePack in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -136,7 +134,6 @@
buildActionMask = 2147483647;
files = (
4BD67C9924ECF53E00147C51 /* Commons in Frameworks */,
4B0B364B25953BA100B06899 /* NvimServerTypes in Frameworks */,
4BD67C9B24ECF53E00147C51 /* MessagePack in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -276,7 +273,6 @@
packageProductDependencies = (
4BD67CBA24ED03BF00147C51 /* Commons */,
4BD67CC924ED042F00147C51 /* MessagePack */,
4B0B365225953CAC00B06899 /* NvimServerTypes */,
);
productName = DrawerPerf;
productReference = 4BD67CA224ED037000147C51 /* DrawerPerf.app */;
@ -298,7 +294,6 @@
packageProductDependencies = (
4BD67C7C24ECF35300147C51 /* Commons */,
4BD67C9624ECF4B300147C51 /* MessagePack */,
4B0B364A25953BA100B06899 /* NvimServerTypes */,
);
productName = DrawerDev;
productReference = 4BF1852021313EE300954FE7 /* DrawerDev.app */;
@ -311,7 +306,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1200;
LastUpgradeCheck = 1340;
LastUpgradeCheck = 1500;
ORGANIZATIONNAME = "Tae Won Ha";
TargetAttributes = {
4B0225EF224AAE260052362B = {
@ -339,7 +334,6 @@
packageReferences = (
4BD67C9524ECF4AB00147C51 /* XCRemoteSwiftPackageReference "MessagePack" */,
4BD67CCF24ED08CB00147C51 /* XCRemoteSwiftPackageReference "PureLayout" */,
1FF017012AF02F64003D62BB /* XCLocalSwiftPackageReference "../../NvimServer" */,
);
productRefGroup = 4B90F0051FD2AF59008A39E0 /* Products */;
projectDirPath = "";
@ -421,6 +415,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B117B5D2B03FF91000DBFB4 /* FontTrait.swift in Sources */,
4BF1852321313EE400954FE7 /* AppDelegate.swift in Sources */,
1929B2DB631E6EB5C3452B68 /* MyView.swift in Sources */,
1929BC29B7858F8E963FD9BE /* AttributesRunDrawer.swift in Sources */,
@ -753,13 +748,6 @@
};
/* End XCConfigurationList section */
/* Begin XCLocalSwiftPackageReference section */
1FF017012AF02F64003D62BB /* XCLocalSwiftPackageReference "../../NvimServer" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ../../NvimServer;
};
/* End XCLocalSwiftPackageReference section */
/* Begin XCRemoteSwiftPackageReference section */
4BD67C9524ECF4AB00147C51 /* XCRemoteSwiftPackageReference "MessagePack" */ = {
isa = XCRemoteSwiftPackageReference;
@ -780,14 +768,6 @@
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
4B0B364A25953BA100B06899 /* NvimServerTypes */ = {
isa = XCSwiftPackageProductDependency;
productName = NvimServerTypes;
};
4B0B365225953CAC00B06899 /* NvimServerTypes */ = {
isa = XCSwiftPackageProductDependency;
productName = NvimServerTypes;
};
4B0B365C25953D3D00B06899 /* NvimView */ = {
isa = XCSwiftPackageProductDependency;
productName = NvimView;

View File

@ -5,14 +5,6 @@
![Screenshot 1](https://raw.githubusercontent.com/qvacua/vimr/develop/resources/screenshot1.png)
![Screenshot 2](https://raw.githubusercontent.com/qvacua/vimr/develop/resources/screenshot2.png)
## Fork differences
Originially and wonderfully by [qvacua](https://github.com/qvacua/) which appears to be unsupported any more.
This version can talk to an arbitrary nvim (once the upstream bits get merged)
It therefore should be able to keep pace with nvim development better. Work was done to avoid
having to modify neovim, and the uibridge mechanism has been replaced with api calls.
## About
Project VimR is a Neovim GUI for macOS.
@ -27,6 +19,8 @@ There are other Neovim GUIs for macOS, see the [list](https://github.com/neovim/
- play around with Swift (and especially with [RxSwift](https://github.com/ReactiveX/RxSwift)), and
- (most importantly) have fun!
We have a chat room: <https://matrix.to/#/#vimr:matrix.org>
If you want to support VimR financially, use [Github's Sponsor](https://github.com/sponsors/qvacua).
## Download

View File

@ -789,7 +789,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 1340;
LastUpgradeCheck = 1500;
ORGANIZATIONNAME = "Tae Won Ha";
TargetAttributes = {
4BEBA5041CFF374B00673FDF = {

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -90,7 +90,7 @@ final class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
self.useInteractiveZshCheckbox.boolState = self.useInteractiveZsh
self.useLiveResizeCheckbox.boolState = self.useLiveResize
self.drawsParallelCheckbox.boolState = self.drawsParallel
self.nvimBinaryField.string = self.nvimBinary ?? ""
self.nvimBinaryField.string = self.nvimBinary
}
private func addViews() {

View File

@ -11,6 +11,7 @@ import os
import PureLayout
import RxSwift
import Sparkle
import UserNotifications
let debugMenuItemIdentifier = NSUserInterfaceItemIdentifier("debug-menu-item")
@ -27,7 +28,7 @@ final class UpdaterDelegate: NSObject, SPUUpdaterDelegate {
}
@main
final class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate {
struct OpenConfig {
var urls: [URL]
var cwd: URL
@ -77,7 +78,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCent
super.init()
NSUserNotificationCenter.default.delegate = self
UNUserNotificationCenter.current().delegate = self
}
override func awakeFromNib() {
@ -440,9 +441,9 @@ extension AppDelegate {
extension AppDelegate {
func userNotificationCenter(
_: NSUserNotificationCenter,
shouldPresent _: NSUserNotification
) -> Bool { true }
_: UNUserNotificationCenter,
willPresent _: UNNotification
) async -> UNNotificationPresentationOptions { .banner }
}
// Keep the rawValues in sync with Action in the `vimr` Python script.

View File

@ -6,7 +6,7 @@
import Foundation
import WebKit
struct Defs {
enum Defs {
static let loggerSubsystem = Bundle.main.bundleIdentifier!
enum LoggerCategory {

View File

@ -13,6 +13,7 @@ import Workspace
extension MainWindow {
func rpcEventAction(params rawParams: [MessagePackValue]) {
Swift.print("################### \(rawParams)")
guard rawParams.count > 0 else { return }
guard let strEvent = rawParams[0].stringValue,

View File

@ -102,7 +102,7 @@ extension MainWindow {
for: .setTheme(Theme(from: nvimTheme, additionalColorDict: colors))
)
)
}, onError: {
}, onFailure: {
_ in self.log.trace("oops couldn't set theme")
})
.disposed(by: self.disposeBag)

View File

@ -9,6 +9,7 @@ import os
import PureLayout
import RxSwift
import Tabs
import UserNotifications
import Workspace
final class MainWindow: NSObject,
@ -575,16 +576,21 @@ final class MainWindow: NSObject,
}
private func showInitError() {
let notification = NSUserNotification()
notification.identifier = UUID().uuidString
notification.title = "Error during initialization"
notification.informativeText =
let content = UNMutableNotificationContent()
content.title = "Error during initialization"
content.body =
"""
There was an error during the initialization of NeoVim.
Use :messages to view the error messages.
There was an error during the initialization of NeoVim. Use :messages to view the error messages.
"""
content.sound = .default
NSUserNotificationCenter.default.deliver(notification)
let request = UNNotificationRequest(
identifier: UUID().uuidString,
content: content,
trigger: nil
)
UNUserNotificationCenter.current().add(request)
}
private func show(warning: NvimView.Warning) {

View File

@ -6,6 +6,7 @@
import Cocoa
import DictionaryCoding
import os
import UserNotifications
final class PrefMiddleware: MiddlewareType {
typealias StateType = AppState
@ -48,12 +49,19 @@ final class PrefMiddleware: MiddlewareType {
}
if !traits.contains(.monoSpace) {
let notification = NSUserNotification()
notification.identifier = UUID().uuidString
notification.title = "No monospaced font"
notification.informativeText = "The font you selected\(newFontNameText) does not seem "
let content = UNMutableNotificationContent()
content.title = "No monospaced font"
content.body = "The font you selected\(newFontNameText) does not seem "
+ "to be a monospaced font. The rendering will most likely be broken."
NSUserNotificationCenter.default.deliver(notification)
content.sound = .default
let request = UNNotificationRequest(
identifier: UUID().uuidString,
content: content,
trigger: nil
)
UNUserNotificationCenter.current().add(request)
}
}

View File

@ -6,7 +6,7 @@
import Cocoa
import NvimView
final class PrefUtils {
enum PrefUtils {
static func value<T>(from dict: [String: Any], for key: String) -> T? {
dict[key] as? T
}

View File

@ -5,7 +5,7 @@
import Foundation
final class Resources {
enum Resources {
static let resourceUrl = Bundle.main.resourceURL!
static let previewUrl = resourceUrl.appendingPathComponent("preview")

View File

@ -39,7 +39,10 @@ struct Theme: CustomStringConvertible {
var background = NSColor.textBackgroundColor
var highlightForeground = NSColor.selectedMenuItemTextColor
var highlightBackground = NSColor.selectedMenuItemColor
// NSColor.selectedMenuItemColor is deprecated. The doc says that
// NSVisualEffectView.Material.selection should be used instead, but I don't know how to get
// an NSColor from it.
var highlightBackground = NSColor.selectedContentBackgroundColor
var directoryForeground = NSColor.textColor