1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-26 07:13:24 +03:00

Extend a bit the min. example

This commit is contained in:
Tae Won Ha 2019-03-27 11:02:27 +01:00
parent f388524ef9
commit 81e4bc8d42
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
5 changed files with 73 additions and 28 deletions

View File

@ -4,11 +4,24 @@
*/ */
import Cocoa import Cocoa
import RxSwift
@NSApplicationMain @NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate { class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) { func applicationDidFinishLaunching(_ aNotification: Notification) {}
// Insert code here to initialize your application
func applicationShouldTerminate(
_: NSApplication
) -> NSApplication.TerminateReply {
let docs = NSDocumentController.shared.documents
if docs.isEmpty { return .terminateNow }
try? Completable
.concat(docs.compactMap { ($0 as? Document)?.quitWithoutSaving() })
.wait()
return .terminateNow
} }
} }

View File

@ -12,12 +12,12 @@
</connections> </connections>
</customObject> </customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="xOd-HO-29H" userLabel="Window"> <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="min-nvim-demo-doc-window" animationBehavior="default" id="xOd-HO-29H" userLabel="Window">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="133" y="235" width="507" height="413"/> <rect key="contentRect" x="133" y="235" width="507" height="413"/>
<rect key="screenRect" x="0.0" y="0.0" width="2880" height="1597"/> <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<value key="minSize" type="size" width="94" height="86"/> <value key="minSize" type="size" width="94" height="86"/>
<view key="contentView" id="gIp-Ho-8D9"> <view key="contentView" id="gIp-Ho-8D9">
<rect key="frame" x="0.0" y="0.0" width="507" height="413"/> <rect key="frame" x="0.0" y="0.0" width="507" height="413"/>

View File

@ -30,8 +30,12 @@ class Document: NSDocument, NSWindowDelegate {
.disposed(by: self.disposeBag) .disposed(by: self.disposeBag)
} }
func quitWithoutSaving() -> Completable {
return self.nvimView.quitNeoVimWithoutSaving()
}
func windowShouldClose(_ sender: NSWindow) -> Bool { func windowShouldClose(_ sender: NSWindow) -> Bool {
try? self.nvimView.quitNeoVimWithoutSaving().wait() try? self.quitWithoutSaving().wait()
return false return false
} }

View File

@ -61,12 +61,8 @@
4B02260C224AAEA80052362B /* PureLayout.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4B022603224AAE770052362B /* PureLayout.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4B02260C224AAEA80052362B /* PureLayout.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4B022603224AAE770052362B /* PureLayout.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4B02260D224AAEA80052362B /* Socket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBC239215FD19C007113C4 /* Socket.framework */; }; 4B02260D224AAEA80052362B /* Socket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBC239215FD19C007113C4 /* Socket.framework */; };
4B02260E224AAEA80052362B /* Socket.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBC239215FD19C007113C4 /* Socket.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4B02260E224AAEA80052362B /* Socket.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBC239215FD19C007113C4 /* Socket.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4B02260F224AAEA80052362B /* RxNeovimApi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B17E548209E3E4100265C1D /* RxNeovimApi.framework */; };
4B022610224AAEA80052362B /* RxNeovimApi.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4B17E548209E3E4100265C1D /* RxNeovimApi.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4B022613224AAEA80052362B /* MessagePack.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB1F5CA209740E900EC394A /* MessagePack.framework */; }; 4B022613224AAEA80052362B /* MessagePack.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB1F5CA209740E900EC394A /* MessagePack.framework */; };
4B022614224AAEA80052362B /* MessagePack.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB1F5CA209740E900EC394A /* MessagePack.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4B022614224AAEA80052362B /* MessagePack.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB1F5CA209740E900EC394A /* MessagePack.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4B022615224AAEA80052362B /* RxMsgpackRpc.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB1F5C8209740E400EC394A /* RxMsgpackRpc.framework */; };
4B022616224AAEA80052362B /* RxMsgpackRpc.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BB1F5C8209740E400EC394A /* RxMsgpackRpc.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4B022617224AAEA80052362B /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC5B0421FE551DF0071D64F /* RxSwift.framework */; }; 4B022617224AAEA80052362B /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC5B0421FE551DF0071D64F /* RxSwift.framework */; };
4B022618224AAEA80052362B /* RxSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC5B0421FE551DF0071D64F /* RxSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4B022618224AAEA80052362B /* RxSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4BC5B0421FE551DF0071D64F /* RxSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4B02261B224AAF1C0052362B /* RxSwiftCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B02261A224AAF1B0052362B /* RxSwiftCommons.swift */; }; 4B02261B224AAF1C0052362B /* RxSwiftCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B02261A224AAF1B0052362B /* RxSwiftCommons.swift */; };
@ -188,9 +184,7 @@
4B02260C224AAEA80052362B /* PureLayout.framework in Embed Frameworks */, 4B02260C224AAEA80052362B /* PureLayout.framework in Embed Frameworks */,
4B022614224AAEA80052362B /* MessagePack.framework in Embed Frameworks */, 4B022614224AAEA80052362B /* MessagePack.framework in Embed Frameworks */,
4B022618224AAEA80052362B /* RxSwift.framework in Embed Frameworks */, 4B022618224AAEA80052362B /* RxSwift.framework in Embed Frameworks */,
4B022616224AAEA80052362B /* RxMsgpackRpc.framework in Embed Frameworks */,
4B022608224AAEA80052362B /* NvimView.framework in Embed Frameworks */, 4B022608224AAEA80052362B /* NvimView.framework in Embed Frameworks */,
4B022610224AAEA80052362B /* RxNeovimApi.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@ -354,9 +348,7 @@
4B02260B224AAEA80052362B /* PureLayout.framework in Frameworks */, 4B02260B224AAEA80052362B /* PureLayout.framework in Frameworks */,
4B022613224AAEA80052362B /* MessagePack.framework in Frameworks */, 4B022613224AAEA80052362B /* MessagePack.framework in Frameworks */,
4B022617224AAEA80052362B /* RxSwift.framework in Frameworks */, 4B022617224AAEA80052362B /* RxSwift.framework in Frameworks */,
4B022615224AAEA80052362B /* RxMsgpackRpc.framework in Frameworks */,
4B022607224AAEA80052362B /* NvimView.framework in Frameworks */, 4B022607224AAEA80052362B /* NvimView.framework in Frameworks */,
4B02260F224AAEA80052362B /* RxNeovimApi.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
<BuildAction>
<BuildActionEntries>
<BuildActionEntry
buildForRunning = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4B0225EF224AAE260052362B"
BuildableName = "MinimalNvimViewDemo.app"
BlueprintName = "MinimalNvimViewDemo"
ReferencedContainer = "container:NvimView.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<LaunchAction
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4B0225EF224AAE260052362B"
BuildableName = "MinimalNvimViewDemo.app"
BlueprintName = "MinimalNvimViewDemo"
ReferencedContainer = "container:NvimView.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<LocationScenarioReference
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
referenceType = "1">
</LocationScenarioReference>
</LaunchAction>
</Scheme>