mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 03:25:03 +03:00
Rename NeoVimView to NvimView
This commit is contained in:
parent
d63dea32a3
commit
be4c38e244
@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1929B40A751BDA2882D4FC94 /* NvimViewObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B22A0CAD417EC3790F02 /* NvimViewObjects.swift */; };
|
||||
4B90F02D1FD2AFAE008A39E0 /* NeoVimUiBridgeProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B90F00F1FD2AFAC008A39E0 /* NeoVimUiBridgeProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
4B90F02E1FD2AFAE008A39E0 /* NeoVimView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B90F0101FD2AFAC008A39E0 /* NeoVimView.swift */; };
|
||||
4B90F02F1FD2AFAE008A39E0 /* NeoVimView+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B90F0111FD2AFAC008A39E0 /* NeoVimView+Resize.swift */; };
|
||||
@ -88,6 +89,7 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1929B22A0CAD417EC3790F02 /* NvimViewObjects.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NvimViewObjects.swift; sourceTree = "<group>"; };
|
||||
4B90F0041FD2AF59008A39E0 /* NvimView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NvimView.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4B90F0081FD2AF59008A39E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
4B90F00F1FD2AFAC008A39E0 /* NeoVimUiBridgeProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NeoVimUiBridgeProtocol.h; sourceTree = "<group>"; };
|
||||
@ -230,6 +232,7 @@
|
||||
4BE45C121FD2DB52005C0A95 /* NeoVimTab.m */,
|
||||
4BE45C101FD2DB52005C0A95 /* NeoVimWindow.h */,
|
||||
4BE45C111FD2DB52005C0A95 /* NeoVimWindow.m */,
|
||||
1929B22A0CAD417EC3790F02 /* NvimViewObjects.swift */,
|
||||
);
|
||||
path = NvimView;
|
||||
sourceTree = "<group>";
|
||||
@ -430,6 +433,7 @@
|
||||
4B90F03A1FD2AFAE008A39E0 /* NeoVimView+Key.swift in Sources */,
|
||||
4B90F0361FD2AFAE008A39E0 /* NeoVimViewDelegate.swift in Sources */,
|
||||
4BE45C181FD2DB53005C0A95 /* NeoVimTab.m in Sources */,
|
||||
1929B40A751BDA2882D4FC94 /* NvimViewObjects.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
import Cocoa
|
||||
import NvimMsgPack
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
public func enterResizeMode() {
|
||||
self.currentlyResizing = true
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
override public func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation {
|
||||
return isFile(sender: sender) ? .copy : NSDragOperation()
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
override public func viewDidMoveToWindow() {
|
||||
self.window?.colorSpace = colorSpace
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
override public func keyDown(with event: NSEvent) {
|
||||
self.keyDownDone = false
|
||||
|
@ -6,7 +6,7 @@
|
||||
import Cocoa
|
||||
|
||||
// MARK: - NSUserInterfaceValidationsProtocol
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
public func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
|
||||
let canUndoOrRedo = self.mode == .insert
|
||||
@ -43,7 +43,7 @@ extension NeoVimView {
|
||||
}
|
||||
|
||||
// MARK: - Edit Menu Items
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
@IBAction func undo(_ sender: AnyObject?) {
|
||||
switch self.mode {
|
||||
@ -145,7 +145,7 @@ extension NeoVimView {
|
||||
}
|
||||
|
||||
// MARK: - Font Menu Items
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
@IBAction func resetFontSize(_ sender: Any?) {
|
||||
self.font = self._font
|
||||
@ -154,14 +154,14 @@ extension NeoVimView {
|
||||
@IBAction func makeFontBigger(_ sender: Any?) {
|
||||
let curFont = self.drawer.font
|
||||
let font = NSFontManager.shared
|
||||
.convert(curFont, toSize: min(curFont.pointSize + 1, NeoVimView.maxFontSize))
|
||||
.convert(curFont, toSize: min(curFont.pointSize + 1, NvimView.maxFontSize))
|
||||
self.updateFontMetaData(font)
|
||||
}
|
||||
|
||||
@IBAction func makeFontSmaller(_ sender: Any?) {
|
||||
let curFont = self.drawer.font
|
||||
let font = NSFontManager.shared
|
||||
.convert(curFont, toSize: max(curFont.pointSize - 1, NeoVimView.minFontSize))
|
||||
.convert(curFont, toSize: max(curFont.pointSize - 1, NvimView.minFontSize))
|
||||
self.updateFontMetaData(font)
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
override public func mouseDown(with event: NSEvent) {
|
||||
self.mouse(event: event, vimName: "LeftMouse")
|
||||
@ -47,7 +47,7 @@ extension NeoVimView {
|
||||
let factor = 1 + event.magnification
|
||||
let pinchTargetScale = self.pinchTargetScale * factor
|
||||
let resultingFontSize = round(pinchTargetScale * self.font.pointSize)
|
||||
if resultingFontSize >= NeoVimView.minFontSize && resultingFontSize <= NeoVimView.maxFontSize {
|
||||
if resultingFontSize >= NvimView.minFontSize && resultingFontSize <= NvimView.maxFontSize {
|
||||
self.pinchTargetScale = pinchTargetScale
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
override public func setFrameSize(_ newSize: NSSize) {
|
||||
super.setFrameSize(newSize)
|
||||
|
@ -7,7 +7,7 @@ import Cocoa
|
||||
import NvimMsgPack
|
||||
|
||||
@available(OSX 10.12.2, *)
|
||||
extension NeoVimView : NSTouchBarDelegate, NSScrubberDataSource, NSScrubberDelegate {
|
||||
extension NvimView: NSTouchBarDelegate, NSScrubberDataSource, NSScrubberDelegate {
|
||||
|
||||
private static let touchBarIdentifier = NSTouchBar.CustomizationIdentifier("com.qvacua.VimR.SwiftNeoVim.touchBar")
|
||||
private static let touchBarTabSwitcherIdentifier = NSTouchBarItem.Identifier("com.qvacua.VimR.SwiftNeoVim.touchBar.tabSwitcher")
|
||||
@ -16,19 +16,19 @@ extension NeoVimView : NSTouchBarDelegate, NSScrubberDataSource, NSScrubberDeleg
|
||||
override public func makeTouchBar() -> NSTouchBar? {
|
||||
let bar = NSTouchBar()
|
||||
bar.delegate = self
|
||||
bar.customizationIdentifier = NeoVimView.touchBarIdentifier
|
||||
bar.defaultItemIdentifiers = [NeoVimView.touchBarTabSwitcherIdentifier]
|
||||
bar.customizationRequiredItemIdentifiers = [NeoVimView.touchBarTabSwitcherIdentifier]
|
||||
bar.customizationIdentifier = NvimView.touchBarIdentifier
|
||||
bar.defaultItemIdentifiers = [NvimView.touchBarTabSwitcherIdentifier]
|
||||
bar.customizationRequiredItemIdentifiers = [NvimView.touchBarTabSwitcherIdentifier]
|
||||
return bar
|
||||
}
|
||||
|
||||
public func touchBar(_ touchBar: NSTouchBar, makeItemForIdentifier identifier: NSTouchBarItem.Identifier) -> NSTouchBarItem? {
|
||||
switch identifier {
|
||||
case NeoVimView.touchBarTabSwitcherIdentifier:
|
||||
case NvimView.touchBarTabSwitcherIdentifier:
|
||||
let item = NSCustomTouchBarItem(identifier: identifier)
|
||||
item.customizationLabel = "Tab Switcher"
|
||||
let tabsControl = NSScrubber()
|
||||
tabsControl.register(NSScrubberTextItemView.self, forItemIdentifier: NSUserInterfaceItemIdentifier(rawValue: NeoVimView.touchBarTabSwitcherItem))
|
||||
tabsControl.register(NSScrubberTextItemView.self, forItemIdentifier: NSUserInterfaceItemIdentifier(rawValue: NvimView.touchBarTabSwitcherItem))
|
||||
tabsControl.mode = .fixed
|
||||
tabsControl.dataSource = self
|
||||
tabsControl.delegate = self
|
||||
@ -49,7 +49,7 @@ extension NeoVimView : NSTouchBarDelegate, NSScrubberDataSource, NSScrubberDeleg
|
||||
}
|
||||
|
||||
private func getTabsControl() -> NSScrubber? {
|
||||
return (self.touchBar?.item(forIdentifier: NeoVimView.touchBarTabSwitcherIdentifier) as? NSCustomTouchBarItem)?.view as? NSScrubber
|
||||
return (self.touchBar?.item(forIdentifier: NvimView.touchBarTabSwitcherIdentifier) as? NSCustomTouchBarItem)?.view as? NSScrubber
|
||||
}
|
||||
|
||||
func updateTouchBarCurrentBuffer() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
public func resize(toWidth width: Int, height: Int) {
|
||||
gui.async {
|
||||
@ -224,7 +224,7 @@ extension NeoVimView {
|
||||
}
|
||||
|
||||
// MARK: - Simple
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
public func bell() {
|
||||
gui.async {
|
||||
@ -309,7 +309,7 @@ extension NeoVimView {
|
||||
}
|
||||
}
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
func markForRender(cellPosition position: Position) {
|
||||
self.markForRender(position: position)
|
||||
@ -347,7 +347,7 @@ extension NeoVimView {
|
||||
}
|
||||
}
|
||||
|
||||
extension NeoVimView {
|
||||
extension NvimView {
|
||||
|
||||
fileprivate func currentBufferChanged(_ handle: Int) {
|
||||
guard let currentBuffer = self.currentBuffer() else {
|
||||
|
@ -6,10 +6,10 @@
|
||||
import Cocoa
|
||||
import NvimMsgPack
|
||||
|
||||
public class NeoVimView: NSView,
|
||||
NeoVimUiBridgeProtocol,
|
||||
NSUserInterfaceValidations,
|
||||
NSTextInputClient {
|
||||
public class NvimView: NSView,
|
||||
NeoVimUiBridgeProtocol,
|
||||
NSUserInterfaceValidations,
|
||||
NSTextInputClient {
|
||||
|
||||
// MARK: - Public
|
||||
public struct Config {
|
||||
@ -75,7 +75,7 @@ public class NeoVimView: NSView,
|
||||
public static let maxLinespacing = CGFloat(8)
|
||||
|
||||
public let uuid = UUID().uuidString
|
||||
public weak var delegate: NeoVimViewDelegate?
|
||||
public weak var delegate: NvimViewDelegate?
|
||||
|
||||
public internal(set) var mode = CursorModeShape.normal
|
||||
|
||||
@ -94,7 +94,7 @@ public class NeoVimView: NSView,
|
||||
}
|
||||
|
||||
set {
|
||||
guard newValue >= NeoVimView.minLinespacing && newValue <= NeoVimView.maxLinespacing else {
|
||||
guard newValue >= NvimView.minLinespacing && newValue <= NvimView.maxLinespacing else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public class NeoVimView: NSView,
|
||||
}
|
||||
|
||||
let size = newValue.pointSize
|
||||
guard size >= NeoVimView.minFontSize && size <= NeoVimView.maxFontSize else {
|
||||
guard size >= NvimView.minFontSize && size <= NvimView.maxFontSize else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -202,8 +202,8 @@ public class NeoVimView: NSView,
|
||||
}
|
||||
}
|
||||
|
||||
let logger = LogContext.fileLogger(as: NeoVimView.self, with: URL(fileURLWithPath: "/tmp/nvv.log"))
|
||||
let bridgeLogger = LogContext.fileLogger(as: NeoVimView.self,
|
||||
let logger = LogContext.fileLogger(as: NvimView.self, with: URL(fileURLWithPath: "/tmp/nvv.log"))
|
||||
let bridgeLogger = LogContext.fileLogger(as: NvimView.self,
|
||||
with: URL(fileURLWithPath: "/tmp/nvv-bridge.log"),
|
||||
shouldLogDebug: nil)
|
||||
let agent: NeoVimAgent
|
||||
@ -240,7 +240,7 @@ public class NeoVimView: NSView,
|
||||
var currentlyResizing = false
|
||||
var currentEmoji = "😎"
|
||||
|
||||
var _font = NeoVimView.defaultFont
|
||||
var _font = NvimView.defaultFont
|
||||
var _cwd = URL(fileURLWithPath: NSHomeDirectory())
|
||||
var shouldDrawCursor = false
|
||||
var isInitialResize = true
|
||||
@ -249,5 +249,5 @@ public class NeoVimView: NSView,
|
||||
var tabsCache = [NeoVimTab]()
|
||||
|
||||
// MARK: - Private
|
||||
fileprivate var _linespacing = NeoVimView.defaultLinespacing
|
||||
fileprivate var _linespacing = NvimView.defaultLinespacing
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
import Cocoa
|
||||
|
||||
// See http://stackoverflow.com/a/24104371 for class
|
||||
public protocol NeoVimViewDelegate: class {
|
||||
public protocol NvimViewDelegate: class {
|
||||
|
||||
func neoVimStopped()
|
||||
func set(title: String)
|
||||
@ -17,7 +17,7 @@ public protocol NeoVimViewDelegate: class {
|
||||
/// Called when the current buffer changes, including when a new one is selected.
|
||||
func currentBufferChanged(_ currentBuffer: NeoVimBuffer)
|
||||
|
||||
func colorschemeChanged(to: NeoVimView.Theme)
|
||||
func colorschemeChanged(to: NvimView.Theme)
|
||||
|
||||
func ipcBecameInvalid(reason: String)
|
||||
|
||||
|
17
NvimView/NvimView/NvimViewObjects.swift
Normal file
17
NvimView/NvimView/NvimViewObjects.swift
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Tae Won Ha - http://taewon.de - @hataewon
|
||||
* See LICENSE
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import NvimMsgPack
|
||||
|
||||
public struct NvimBuffer {
|
||||
|
||||
public let apiBuffer: NvimApi.Buffer
|
||||
public let url: URL
|
||||
|
||||
public let isDirty: Bool
|
||||
public let isCurrent: Bool
|
||||
public let isTransient: Bool
|
||||
}
|
@ -318,12 +318,12 @@ extension AppearancePref {
|
||||
fileprivate func cappedLinespacing(_ linespacing: Float) -> CGFloat {
|
||||
let cgfLinespacing = CGFloat(linespacing)
|
||||
|
||||
guard cgfLinespacing >= NeoVimView.minLinespacing else {
|
||||
return NeoVimView.defaultLinespacing
|
||||
guard cgfLinespacing >= NvimView.minLinespacing else {
|
||||
return NvimView.defaultLinespacing
|
||||
}
|
||||
|
||||
guard cgfLinespacing <= NeoVimView.maxLinespacing else {
|
||||
return NeoVimView.maxLinespacing
|
||||
guard cgfLinespacing <= NvimView.maxLinespacing else {
|
||||
return NvimView.maxLinespacing
|
||||
}
|
||||
|
||||
return cgfLinespacing
|
||||
@ -332,12 +332,12 @@ extension AppearancePref {
|
||||
fileprivate func cappedFontSize(_ size: Int) -> CGFloat {
|
||||
let cgfSize = CGFloat(size)
|
||||
|
||||
guard cgfSize >= NeoVimView.minFontSize else {
|
||||
return NeoVimView.defaultFont.pointSize
|
||||
guard cgfSize >= NvimView.minFontSize else {
|
||||
return NvimView.defaultFont.pointSize
|
||||
}
|
||||
|
||||
guard cgfSize <= NeoVimView.maxFontSize else {
|
||||
return NeoVimView.maxFontSize
|
||||
guard cgfSize <= NvimView.maxFontSize else {
|
||||
return NvimView.maxFontSize
|
||||
}
|
||||
|
||||
return cgfSize
|
||||
|
@ -98,7 +98,7 @@ extension MainWindow {
|
||||
|
||||
@IBAction func toggleAllTools(_ sender: Any?) {
|
||||
self.workspace.toggleAllTools()
|
||||
self.focusNeoVimView(self)
|
||||
self.focusNvimView(self)
|
||||
|
||||
self.emit(self.uuidAction(for: .toggleAllTools(self.workspace.isAllToolsVisible)))
|
||||
}
|
||||
@ -114,7 +114,7 @@ extension MainWindow {
|
||||
if fileBrowser?.isSelected == true {
|
||||
if fileBrowser?.view.isFirstResponder == true {
|
||||
fileBrowser?.toggle()
|
||||
self.focusNeoVimView(self)
|
||||
self.focusNvimView(self)
|
||||
} else {
|
||||
self.emit(self.uuidAction(for: .focus(.fileBrowser)))
|
||||
}
|
||||
@ -126,7 +126,7 @@ extension MainWindow {
|
||||
self.emit(self.uuidAction(for: .focus(.fileBrowser)))
|
||||
}
|
||||
|
||||
@IBAction func focusNeoVimView(_: Any?) {
|
||||
@IBAction func focusNvimView(_: Any?) {
|
||||
// self.window.makeFirstResponder(self.neoVimView)
|
||||
self.emit(self.uuidAction(for: .focus(.neoVimView)))
|
||||
}
|
||||
@ -140,7 +140,7 @@ extension MainWindow {
|
||||
let canSaveAs = canSave
|
||||
let canOpen = canSave
|
||||
let canOpenQuickly = canSave
|
||||
let canFocusNeoVimView = self.window.firstResponder != self.neoVimView
|
||||
let canFocusNvimView = self.window.firstResponder != self.neoVimView
|
||||
let canToggleFileBrowser = self.tools.keys.contains(.fileBrowser)
|
||||
let canToggleTools = !self.tools.isEmpty
|
||||
|
||||
@ -156,8 +156,8 @@ extension MainWindow {
|
||||
case #selector(toggleFileBrowser(_:)):
|
||||
return canToggleFileBrowser
|
||||
|
||||
case #selector(focusNeoVimView(_:)):
|
||||
return canFocusNeoVimView
|
||||
case #selector(focusNvimView(_:)):
|
||||
return canFocusNvimView
|
||||
|
||||
case #selector(openDocument(_:)):
|
||||
return canOpen
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
// MARK: - NeoVimViewDelegate
|
||||
// MARK: - NvimViewDelegate
|
||||
extension MainWindow {
|
||||
|
||||
func neoVimStopped() {
|
||||
@ -67,7 +67,7 @@ extension MainWindow {
|
||||
self.currentBufferChanged(currentBuffer)
|
||||
}
|
||||
|
||||
func colorschemeChanged(to neoVimTheme: NeoVimView.Theme) {
|
||||
func colorschemeChanged(to neoVimTheme: NvimView.Theme) {
|
||||
self.emit(uuidAction(for: .setTheme(Theme(neoVimTheme))))
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import PureLayout
|
||||
|
||||
class MainWindow: NSObject,
|
||||
UiComponent,
|
||||
NeoVimViewDelegate,
|
||||
NvimViewDelegate,
|
||||
NSWindowDelegate,
|
||||
NSUserInterfaceValidations,
|
||||
WorkspaceDelegate {
|
||||
@ -80,7 +80,7 @@ class MainWindow: NSObject,
|
||||
}
|
||||
|
||||
let workspace: Workspace
|
||||
let neoVimView: NeoVimView
|
||||
let neoVimView: NvimView
|
||||
|
||||
let scrollDebouncer = Debouncer<Action>(interval: 0.75)
|
||||
let cursorDebouncer = Debouncer<Action>(interval: 0.75)
|
||||
@ -110,10 +110,10 @@ class MainWindow: NSObject,
|
||||
|
||||
self.windowController = NSWindowController(windowNibName: NSNib.Name(rawValue: "MainWindow"))
|
||||
|
||||
let neoVimViewConfig = NeoVimView.Config(useInteractiveZsh: state.useInteractiveZsh,
|
||||
cwd: state.cwd,
|
||||
nvimArgs: state.nvimArgs)
|
||||
self.neoVimView = NeoVimView(frame: .zero, config: neoVimViewConfig)
|
||||
let neoVimViewConfig = NvimView.Config(useInteractiveZsh: state.useInteractiveZsh,
|
||||
cwd: state.cwd,
|
||||
nvimArgs: state.nvimArgs)
|
||||
self.neoVimView = NvimView(frame: .zero, config: neoVimViewConfig)
|
||||
self.neoVimView.configureForAutoLayout()
|
||||
|
||||
self.workspace = Workspace(mainView: self.neoVimView)
|
||||
@ -318,8 +318,8 @@ class MainWindow: NSObject,
|
||||
|
||||
fileprivate var currentBuffer: NeoVimBuffer?
|
||||
|
||||
fileprivate var defaultFont = NeoVimView.defaultFont
|
||||
fileprivate var linespacing = NeoVimView.defaultLinespacing
|
||||
fileprivate var defaultFont = NvimView.defaultFont
|
||||
fileprivate var linespacing = NvimView.defaultLinespacing
|
||||
fileprivate var usesLigatures = false
|
||||
|
||||
fileprivate var previewPosition = Marked(Position.beginning)
|
||||
|
@ -215,8 +215,8 @@ fileprivate struct AppearancePrefData: Equatable, StandardPrefData {
|
||||
&& left.editorLinespacing == right.editorLinespacing
|
||||
}
|
||||
|
||||
static let `default` = AppearancePrefData(editorFont: NeoVimView.defaultFont,
|
||||
editorLinespacing: NeoVimView.defaultLinespacing,
|
||||
static let `default` = AppearancePrefData(editorFont: NvimView.defaultFont,
|
||||
editorLinespacing: NvimView.defaultLinespacing,
|
||||
editorUsesLigatures: false)
|
||||
|
||||
var editorFont: NSFont
|
||||
|
@ -81,12 +81,12 @@ class PrefUtils {
|
||||
}
|
||||
|
||||
static func saneFont(_ fontName: String, fontSize: CGFloat) -> NSFont {
|
||||
var editorFont = NSFont(name: fontName, size: fontSize) ?? NeoVimView.defaultFont
|
||||
var editorFont = NSFont(name: fontName, size: fontSize) ?? NvimView.defaultFont
|
||||
if !editorFont.isFixedPitch {
|
||||
editorFont = NSFontManager.shared.convert(NeoVimView.defaultFont, toSize: editorFont.pointSize)
|
||||
editorFont = NSFontManager.shared.convert(NvimView.defaultFont, toSize: editorFont.pointSize)
|
||||
}
|
||||
if editorFont.pointSize < NeoVimView.minFontSize || editorFont.pointSize > NeoVimView.maxFontSize {
|
||||
editorFont = NSFontManager.shared.convert(editorFont, toSize: NeoVimView.defaultFont.pointSize)
|
||||
if editorFont.pointSize < NvimView.minFontSize || editorFont.pointSize > NvimView.maxFontSize {
|
||||
editorFont = NSFontManager.shared.convert(editorFont, toSize: NvimView.defaultFont.pointSize)
|
||||
}
|
||||
|
||||
return editorFont
|
||||
@ -94,8 +94,8 @@ class PrefUtils {
|
||||
|
||||
static func saneLinespacing(_ fLinespacing: Float) -> CGFloat {
|
||||
let linespacing = CGFloat(fLinespacing)
|
||||
guard linespacing >= NeoVimView.minLinespacing && linespacing <= NeoVimView.maxLinespacing else {
|
||||
return NeoVimView.defaultLinespacing
|
||||
guard linespacing >= NvimView.minLinespacing && linespacing <= NvimView.maxLinespacing else {
|
||||
return NvimView.defaultLinespacing
|
||||
}
|
||||
|
||||
return linespacing
|
||||
|
@ -51,7 +51,7 @@ struct Theme: CustomStringConvertible {
|
||||
|
||||
}
|
||||
|
||||
init(_ neoVimTheme: NeoVimView.Theme) {
|
||||
init(_ neoVimTheme: NvimView.Theme) {
|
||||
self.foreground = neoVimTheme.foreground
|
||||
self.background = neoVimTheme.background
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user