Repo // Clang-format.
This commit is contained in:
parent
e0762339ef
commit
7d6ac3cd5f
|
@ -40,6 +40,7 @@ extension KeyHandler {
|
||||||
stateCallback: @escaping (InputStateProtocol) -> Void,
|
stateCallback: @escaping (InputStateProtocol) -> Void,
|
||||||
errorCallback: @escaping () -> Void
|
errorCallback: @escaping () -> Void
|
||||||
) -> Bool? {
|
) -> Bool? {
|
||||||
|
guard [.ofInputting, .ofEmpty, .ofEmptyIgnoringPreviousState].contains(state.type) else { return nil }
|
||||||
|
|
||||||
// MARK: 注音按鍵輸入處理 (Handle BPMF Keys)
|
// MARK: 注音按鍵輸入處理 (Handle BPMF Keys)
|
||||||
|
|
||||||
|
|
|
@ -159,8 +159,8 @@ extension KeyHandler {
|
||||||
// MARK: 注音按鍵輸入處理 (Handle BPMF Keys)
|
// MARK: 注音按鍵輸入處理 (Handle BPMF Keys)
|
||||||
|
|
||||||
if let compositionHandled = handleComposition(
|
if let compositionHandled = handleComposition(
|
||||||
input: input, state: state, stateCallback: stateCallback, errorCallback: errorCallback)
|
input: input, state: state, stateCallback: stateCallback, errorCallback: errorCallback
|
||||||
{
|
) {
|
||||||
return compositionHandled
|
return compositionHandled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ extension vChewing {
|
||||||
do {
|
do {
|
||||||
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
|
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
|
||||||
strData = strData.replacingOccurrences(of: "\r", with: "\n")
|
strData = strData.replacingOccurrences(of: "\r", with: "\n")
|
||||||
strData.ranges(splitBy: "\n").filter({ !$0.isEmpty }).forEach {
|
strData.ranges(splitBy: "\n").filter { !$0.isEmpty }.forEach {
|
||||||
let neta = strData[$0].split(separator: " ")
|
let neta = strData[$0].split(separator: " ")
|
||||||
if neta.count >= 2 {
|
if neta.count >= 2 {
|
||||||
let theKey = String(neta[0])
|
let theKey = String(neta[0])
|
||||||
|
|
|
@ -87,7 +87,7 @@ extension vChewing {
|
||||||
do {
|
do {
|
||||||
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
|
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
|
||||||
strData = strData.replacingOccurrences(of: "\r", with: "\n")
|
strData = strData.replacingOccurrences(of: "\r", with: "\n")
|
||||||
strData.ranges(splitBy: "\n").filter({ !$0.isEmpty }).forEach {
|
strData.ranges(splitBy: "\n").filter { !$0.isEmpty }.forEach {
|
||||||
let neta = strData[$0].split(separator: " ")
|
let neta = strData[$0].split(separator: " ")
|
||||||
if neta.count >= 2, String(neta[0]).first != "#" {
|
if neta.count >= 2, String(neta[0]).first != "#" {
|
||||||
if !neta[0].isEmpty, !neta[1].isEmpty {
|
if !neta[0].isEmpty, !neta[1].isEmpty {
|
||||||
|
|
|
@ -53,7 +53,7 @@ extension vChewing {
|
||||||
do {
|
do {
|
||||||
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
|
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
|
||||||
strData = strData.replacingOccurrences(of: "\r", with: "\n")
|
strData = strData.replacingOccurrences(of: "\r", with: "\n")
|
||||||
strData.ranges(splitBy: "\n").filter({ !$0.isEmpty }).forEach {
|
strData.ranges(splitBy: "\n").filter { !$0.isEmpty }.forEach {
|
||||||
let neta = strData[$0].split(separator: " ")
|
let neta = strData[$0].split(separator: " ")
|
||||||
if neta.count >= 2 {
|
if neta.count >= 2 {
|
||||||
let theKey = String(neta[0])
|
let theKey = String(neta[0])
|
||||||
|
|
|
@ -107,12 +107,13 @@ public class ctlCandidate: NSWindowController, ctlCandidateProtocol {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
required public init(_ layout: CandidateLayout = .horizontal) {
|
public required init(_: CandidateLayout = .horizontal) {
|
||||||
super.init(window: .init())
|
super.init(window: .init())
|
||||||
visible = false
|
visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
@available(*, unavailable)
|
||||||
|
required init?(coder _: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ public class ctlCandidateUniversal: ctlCandidate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
required public init(_ layout: CandidateLayout = .horizontal) {
|
public required init(_ layout: CandidateLayout = .horizontal) {
|
||||||
var contentRect = NSRect(x: 128.0, y: 128.0, width: 0.0, height: 0.0)
|
var contentRect = NSRect(x: 128.0, y: 128.0, width: 0.0, height: 0.0)
|
||||||
let styleMask: NSWindow.StyleMask = [.nonactivatingPanel]
|
let styleMask: NSWindow.StyleMask = [.nonactivatingPanel]
|
||||||
let panel = NSPanel(
|
let panel = NSPanel(
|
||||||
|
@ -449,7 +449,7 @@ public class ctlCandidateUniversal: ctlCandidate {
|
||||||
// MARK: Post-Init()
|
// MARK: Post-Init()
|
||||||
|
|
||||||
super.init(layout)
|
super.init(layout)
|
||||||
self.window = panel
|
window = panel
|
||||||
currentLayout = layout
|
currentLayout = layout
|
||||||
|
|
||||||
candidateView.target = self
|
candidateView.target = self
|
||||||
|
|
|
@ -57,13 +57,13 @@ class ctlAboutWindow: NSWindowController {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func btnBugReport(_ sender: NSButton) {
|
@IBAction func btnBugReport(_: NSButton) {
|
||||||
if let url = URL(string: "https://vchewing.github.io/BUGREPORT.html") {
|
if let url = URL(string: "https://vchewing.github.io/BUGREPORT.html") {
|
||||||
NSWorkspace.shared.open(url)
|
NSWorkspace.shared.open(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func btnWebsite(_ sender: NSButton) {
|
@IBAction func btnWebsite(_: NSButton) {
|
||||||
if let url = URL(string: "https://vchewing.github.io/") {
|
if let url = URL(string: "https://vchewing.github.io/") {
|
||||||
NSWorkspace.shared.open(url)
|
NSWorkspace.shared.open(url)
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,7 +388,8 @@ extension ctlPrefWindow: NSToolbarDelegate {
|
||||||
item.label = title
|
item.label = title
|
||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
item.image = NSImage(
|
item.image = NSImage(
|
||||||
systemSymbolName: "wrench.and.screwdriver.fill", accessibilityDescription: "General Preferences")
|
systemSymbolName: "wrench.and.screwdriver.fill", accessibilityDescription: "General Preferences"
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
item.image = NSImage(named: NSImage.homeTemplateName)
|
item.image = NSImage(named: NSImage.homeTemplateName)
|
||||||
}
|
}
|
||||||
|
@ -399,7 +400,8 @@ extension ctlPrefWindow: NSToolbarDelegate {
|
||||||
item.label = title
|
item.label = title
|
||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
item.image = NSImage(
|
item.image = NSImage(
|
||||||
systemSymbolName: "person.fill.questionmark", accessibilityDescription: "Experiences Preferences")
|
systemSymbolName: "person.fill.questionmark", accessibilityDescription: "Experiences Preferences"
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
item.image = NSImage(named: NSImage.flowViewTemplateName)
|
item.image = NSImage(named: NSImage.flowViewTemplateName)
|
||||||
}
|
}
|
||||||
|
@ -410,7 +412,8 @@ extension ctlPrefWindow: NSToolbarDelegate {
|
||||||
item.label = title
|
item.label = title
|
||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
item.image = NSImage(
|
item.image = NSImage(
|
||||||
systemSymbolName: "character.book.closed.fill", accessibilityDescription: "Dictionary Preferences")
|
systemSymbolName: "character.book.closed.fill", accessibilityDescription: "Dictionary Preferences"
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
item.image = NSImage(named: NSImage.bookmarksTemplateName)
|
item.image = NSImage(named: NSImage.bookmarksTemplateName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ import Cocoa
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func btnWebsite(_ sender: NSButton) {
|
@IBAction func btnWebsite(_: NSButton) {
|
||||||
if let url = URL(string: "https://vchewing.github.io/") {
|
if let url = URL(string: "https://vchewing.github.io/") {
|
||||||
NSWorkspace.shared.open(url)
|
NSWorkspace.shared.open(url)
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,7 +357,7 @@ extension String {
|
||||||
|
|
||||||
extension vChewing.LMAssociates {
|
extension vChewing.LMAssociates {
|
||||||
public mutating func forceOpenStringInstead(_ strData: String) {
|
public mutating func forceOpenStringInstead(_ strData: String) {
|
||||||
strData.ranges(splitBy: "\n").filter({ !$0.isEmpty }).forEach {
|
strData.ranges(splitBy: "\n").filter { !$0.isEmpty }.forEach {
|
||||||
let neta = strData[$0].split(separator: " ")
|
let neta = strData[$0].split(separator: " ")
|
||||||
if neta.count >= 2 {
|
if neta.count >= 2 {
|
||||||
let theKey = String(neta[0])
|
let theKey = String(neta[0])
|
||||||
|
|
Loading…
Reference in New Issue