1
1
mirror of https://github.com/qvacua/vimr.git synced 2025-01-02 10:43:41 +03:00

Merge branch 'master' into update-neovim

Conflicts:
	NvimServer
This commit is contained in:
Tae Won Ha 2022-11-09 19:54:16 +01:00
commit 87cb8517b8
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
17 changed files with 71 additions and 196 deletions

View File

@ -4,12 +4,12 @@ import PackageDescription
let package = Package(
name: "Commons",
platforms: [.macOS(.v10_13)],
platforms: [.macOS(.v10_15)],
products: [
.library(name: "Commons", targets: ["Commons", "CommonsObjC"]),
],
dependencies: [
.package(url: "https://github.com/Quick/Nimble", from: "10.0.0"),
.package(url: "https://github.com/Quick/Nimble", from: "11.1.0"),
],
targets: [
.target(name: "Commons", dependencies: []),

View File

@ -63,8 +63,10 @@ public extension NSColor {
}
convenience init?(hex: String) {
var result: UInt32 = 0
guard hex.count == 6, Scanner(string: hex).scanHexInt32(&result) else { return nil }
guard hex.count == 6,
let uint64 = Scanner(string: hex).scanUInt64(representation: .hexadecimal)
else { return nil }
let result = UInt32(uint64)
let r = (result & 0xFF0000) >> 16
let g = (result & 0x00FF00) >> 8
@ -126,7 +128,7 @@ public extension NSView {
/// - Warning: Call only in drawRect()
func rectsBeingDrawn() -> [CGRect] {
var rectsPtr: UnsafePointer<CGRect>?
var count: Int = 0
var count = 0
self.getRectsBeingDrawn(&rectsPtr, count: &count)
return Array(UnsafeBufferPointer(start: rectsPtr, count: count))
@ -134,7 +136,8 @@ public extension NSView {
}
public extension NSEvent.ModifierFlags {
// Values are from https://github.com/SFML/SFML/blob/master/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm
// Values are from
// https://github.com/SFML/SFML/blob/master/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm
static let rightShift = NSEvent.ModifierFlags(rawValue: 0x020004)
static let leftShift = NSEvent.ModifierFlags(rawValue: 0x020002)
static let rightCommand = NSEvent.ModifierFlags(rawValue: 0x100010)

View File

@ -134,9 +134,4 @@ public extension URL {
var isPackage: Bool { (try? self.resourceValues(forKeys: [.isPackageKey]))?.isPackage ?? false }
}
public extension ValueTransformer {
static var keyedUnarchiveFromDataTransformer
= ValueTransformer(forName: .keyedUnarchiveFromDataTransformerName)!
}
private let log = OSLog(subsystem: "com.qvacua.vimr.commons", category: "general")

View File

@ -202,7 +202,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@ -257,7 +257,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SWIFT_COMPILATION_MODE = wholemodule;

View File

@ -4,13 +4,13 @@ import PackageDescription
let package = Package(
name: "Ignore",
platforms: [.macOS(.v10_13)],
platforms: [.macOS(.v10_15)],
products: [
.library(name: "Ignore", targets: ["Ignore"]),
],
dependencies: [
.package(url: "https://github.com/qvacua/misc.swift", exact: "0.0.1"),
.package(url: "https://github.com/Quick/Nimble", from: "10.0.0"),
.package(url: "https://github.com/qvacua/misc.swift", exact: "0.2.0"),
.package(url: "https://github.com/Quick/Nimble", from: "11.1.0"),
],
targets: [
.target(name: "Ignore", dependencies: [.product(name: "WildmatchC", package: "misc.swift")]),

View File

@ -9,10 +9,10 @@ let package = Package(
.library(name: "NvimView", targets: ["NvimView"]),
],
dependencies: [
.package(url: "https://github.com/qvacua/RxPack.swift", from: "0.1.0"),
.package(url: "https://github.com/qvacua/RxPack.swift", from: "0.2.0"),
.package(url: "https://github.com/a2/MessagePack.swift", from: "4.0.0"),
.package(url: "https://github.com/ReactiveX/RxSwift", from: "6.5.0"),
.package(url: "https://github.com/Quick/Nimble", from: "10.0.0"),
.package(url: "https://github.com/Quick/Nimble", from: "11.1.0"),
.package(name: "NvimServer", path: "../NvimServer"),
.package(name: "Commons", path: "../Commons"),
.package(name: "Tabs", path: "../Tabs"),

View File

@ -564,7 +564,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@ -623,7 +623,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_DISABLE_SAFETY_CHECKS = YES;

View File

@ -4,7 +4,7 @@ import PackageDescription
let package = Package(
name: "Tabs",
platforms: [.macOS(.v10_13)],
platforms: [.macOS(.v10_15)],
products: [
.library(name: "Tabs", targets: ["Tabs"]),
],

View File

@ -77,8 +77,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/qvacua/misc.swift",
"state" : {
"revision" : "e963af99e5eddc14b0f28c5c87a1f582c88bf128",
"version" : "0.0.1"
"revision" : "7edc70087f16fdc411d24b0fe726e55f9d65d982",
"version" : "0.2.0"
}
},
{
@ -86,8 +86,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Quick/Nimble",
"state" : {
"revision" : "1f3bde57bde12f5e7b07909848c071e9b73d6edc",
"version" : "10.0.0"
"revision" : "96f0ee4751318a5b3c36f347522cfacfd5aa1473",
"version" : "11.1.0"
}
},
{
@ -104,8 +104,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/qvacua/RxPack.swift",
"state" : {
"revision" : "c47c1a1bf33f6f8380bc74fb788d9b5554c09f93",
"version" : "0.1.0"
"revision" : "c6ac590f28d16f1f4e37e737b226fd4229f24a98",
"version" : "0.2.0"
}
},
{

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@ -933,6 +933,7 @@
/* Begin PBXShellScriptBuildPhase section */
4B19BEFF1E110208007E823C /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@ -1363,7 +1364,7 @@
repositoryURL = "https://github.com/qvacua/misc.swift";
requirement = {
kind = exactVersion;
version = 0.0.1;
version = 0.2.0;
};
};
4BA284B0256471ED00CFDF7F /* XCRemoteSwiftPackageReference "Sparkle" */ = {
@ -1387,7 +1388,7 @@
repositoryURL = "https://github.com/qvacua/RxPack.swift";
requirement = {
kind = exactVersion;
version = 0.1.0;
version = 0.2.0;
};
};
4BD5655124E8014100D52809 /* XCRemoteSwiftPackageReference "swifter" */ = {
@ -1426,8 +1427,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Quick/Nimble";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 10.0.0;
kind = upToNextMajorVersion;
minimumVersion = 11.1.0;
};
};
/* End XCRemoteSwiftPackageReference section */

View File

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4BEBA5041CFF374B00673FDF"
BuildableName = "VimR.app"
BlueprintName = "VimR"
ReferencedContainer = "container:VimR.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4BEBA5041CFF374B00673FDF"
BuildableName = "VimR.app"
BlueprintName = "VimR"
ReferencedContainer = "container:VimR.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4BEBA5041CFF374B00673FDF"
BuildableName = "VimR.app"
BlueprintName = "VimR"
ReferencedContainer = "container:VimR.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4BEBA5131CFF374B00673FDF"
BuildableName = "VimRTests.xctest"
BlueprintName = "VimRTests"
ReferencedContainer = "container:VimR.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4BEBA5131CFF374B00673FDF"
BuildableName = "VimRTests.xctest"
BlueprintName = "VimRTests"
ReferencedContainer = "container:VimR.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -8,6 +8,24 @@ import PureLayout
import RxSwift
import ShortcutRecorder
final class ShortcutValueTransformer: ValueTransformer {
static let shared = ShortcutValueTransformer()
override class func allowsReverseTransformation() -> Bool { true }
/// Data to Shortcut
override func transformedValue(_ value: Any?) -> Any? {
guard let value, let data = value as? Data else { return nil }
return try? NSKeyedUnarchiver.unarchivedObject(ofClass: Shortcut.self, from: data)
}
/// Shortcut to Data
override func reverseTransformedValue(_ value: Any?) -> Any? {
guard let value, let shortcut = value as? Shortcut else { return nil }
return try? NSKeyedArchiver.archivedData(withRootObject: shortcut, requiringSecureCoding: true)
}
}
final class ShortcutsPref: PrefPane,
UiComponent,
NSOutlineViewDelegate,
@ -93,9 +111,7 @@ final class ShortcutsPref: PrefPane,
shortcut = defaultShortcuts[id] ?? nil
}
let data = ValueTransformer
.keyedUnarchiveFromDataTransformer
.reverseTransformedValue(shortcut) as? NSData
let data = ShortcutValueTransformer.shared.reverseTransformedValue(shortcut) as? NSData
self.shortcutsUserDefaults?.set(data, forKey: id)
}
@ -103,7 +119,7 @@ final class ShortcutsPref: PrefPane,
}
private func initShortcutUserDefaults() {
let transformer = ValueTransformer.keyedUnarchiveFromDataTransformer
let transformer = ShortcutValueTransformer.shared
defaultShortcuts.forEach { id, shortcut in
if self.shortcutsUserDefaults?.value(forKey: id) == nil {
let shortcutData = transformer.reverseTransformedValue(shortcut) as? NSData
@ -206,7 +222,7 @@ final class ShortcutsPref: PrefPane,
}
private func updateShortcutService() {
let transformer = ValueTransformer.keyedUnarchiveFromDataTransformer
let transformer = ShortcutValueTransformer.shared
let shortcuts = defaultShortcuts.compactMap { id, shortcut -> Shortcut? in
if self.shortcutsUserDefaults?.value(forKey: id) == nil { return shortcut }
@ -269,9 +285,7 @@ extension ShortcutsPref {
guard response == .alertSecondButtonReturn else { return }
self.traverseMenuItems { identifier, _ in
let shortcut = defaultShortcuts[identifier] ?? Shortcut(keyEquivalent: "")
let valueToWrite = ValueTransformer
.keyedUnarchiveFromDataTransformer
.reverseTransformedValue(shortcut)
let valueToWrite = ShortcutValueTransformer.shared.reverseTransformedValue(shortcut)
self.shortcutsDefaultsController.setValue(valueToWrite, forKeyPath: "values.\(identifier)")
@ -329,8 +343,7 @@ extension ShortcutsPref {
forKeyPath: "values.\(identifier)"
) as? NSData else { return true }
guard let shortcutFromDefaults = ValueTransformer
.keyedUnarchiveFromDataTransformer
guard let shortcutFromDefaults = ShortcutValueTransformer.shared
.transformedValue(dataFromDefaults) as? Shortcut else { return true }
let defaultShortcut = defaultShortcuts[identifier] ?? nil
@ -353,9 +366,9 @@ private let defaultsVersion = 337
private class DataToKeyEquivalentTransformer: ValueTransformer {
override func transformedValue(_ value: Any?) -> Any? {
guard let shortcut = ValueTransformer
.keyedUnarchiveFromDataTransformer
.transformedValue(value) as? Shortcut else { return "" }
guard let shortcut = ShortcutValueTransformer.shared.transformedValue(value) as? Shortcut else {
return ""
}
return KeyEquivalentTransformer.shared.transformedValue(shortcut)
}
@ -363,8 +376,7 @@ private class DataToKeyEquivalentTransformer: ValueTransformer {
private class DataToKeyEquivalentModifierMaskTransformer: ValueTransformer {
override func transformedValue(_ value: Any?) -> Any? {
guard let shortcut = ValueTransformer
.keyedUnarchiveFromDataTransformer
guard let shortcut = ShortcutValueTransformer.shared
.transformedValue(value) as? Shortcut else { return NSNumber(value: 0) }
return KeyEquivalentModifierMaskTransformer.shared.transformedValue(shortcut)

View File

@ -40,7 +40,7 @@ final class ShortcutTableCell: NSTableCellView {
.value,
to: content,
withKeyPath: keypath,
options: [.valueTransformer: ValueTransformer.keyedUnarchiveFromDataTransformer]
options: [.valueTransformer: ShortcutValueTransformer.shared]
)
}

View File

@ -4,7 +4,7 @@ import PackageDescription
let package = Package(
name: "Workspace",
platforms: [.macOS(.v10_13)],
platforms: [.macOS(.v10_15)],
products: [
.library(name: "Workspace", targets: ["Workspace"]),
],

View File

@ -56,6 +56,16 @@ check_gh_release_present() {
build_release() {
echo "### Building release"
# Check whether NvimServer submodule is clean
git submodule update
pushd NvimServer >/dev/null
if [[ ! -z "$(git status --porcelain)" ]]; then
echo "NvimServer submodule not clean!"
exit 1
fi
popd >/dev/null
clean=true notarize=true use_carthage_cache=false ./bin/build_vimr.sh
pushd "${build_folder_path}" >/dev/null

View File

@ -17,7 +17,7 @@
${release_notes_link}
</releaseNotesLink>
<pubDate>${publication_date}</pubDate>
<minimumSystemVersion>10.13.0</minimumSystemVersion>
<minimumSystemVersion>10.15.0</minimumSystemVersion>
<enclosure url="${file_url}"
${signature_output}
type="application/octet-stream"/>