Repo // Clang-format.

This commit is contained in:
ShikiSuen 2022-07-31 19:15:09 +08:00
parent e0762339ef
commit 7d6ac3cd5f
11 changed files with 21 additions and 16 deletions

View File

@ -40,6 +40,7 @@ extension KeyHandler {
stateCallback: @escaping (InputStateProtocol) -> Void,
errorCallback: @escaping () -> Void
) -> Bool? {
guard [.ofInputting, .ofEmpty, .ofEmptyIgnoringPreviousState].contains(state.type) else { return nil }
// MARK: (Handle BPMF Keys)

View File

@ -159,8 +159,8 @@ extension KeyHandler {
// MARK: (Handle BPMF Keys)
if let compositionHandled = handleComposition(
input: input, state: state, stateCallback: stateCallback, errorCallback: errorCallback)
{
input: input, state: state, stateCallback: stateCallback, errorCallback: errorCallback
) {
return compositionHandled
}

View File

@ -62,7 +62,7 @@ extension vChewing {
do {
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
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: " ")
if neta.count >= 2 {
let theKey = String(neta[0])

View File

@ -87,7 +87,7 @@ extension vChewing {
do {
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
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: " ")
if neta.count >= 2, String(neta[0]).first != "#" {
if !neta[0].isEmpty, !neta[1].isEmpty {

View File

@ -53,7 +53,7 @@ extension vChewing {
do {
strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ")
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: " ")
if neta.count >= 2 {
let theKey = String(neta[0])

View File

@ -107,12 +107,13 @@ public class ctlCandidate: NSWindowController, ctlCandidateProtocol {
}
}
required public init(_ layout: CandidateLayout = .horizontal) {
public required init(_: CandidateLayout = .horizontal) {
super.init(window: .init())
visible = false
}
required init?(coder: NSCoder) {
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

View File

@ -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)
let styleMask: NSWindow.StyleMask = [.nonactivatingPanel]
let panel = NSPanel(
@ -449,7 +449,7 @@ public class ctlCandidateUniversal: ctlCandidate {
// MARK: Post-Init()
super.init(layout)
self.window = panel
window = panel
currentLayout = layout
candidateView.target = self

View File

@ -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") {
NSWorkspace.shared.open(url)
}
}
@IBAction func btnWebsite(_ sender: NSButton) {
@IBAction func btnWebsite(_: NSButton) {
if let url = URL(string: "https://vchewing.github.io/") {
NSWorkspace.shared.open(url)
}

View File

@ -388,7 +388,8 @@ extension ctlPrefWindow: NSToolbarDelegate {
item.label = title
if #available(macOS 11.0, *) {
item.image = NSImage(
systemSymbolName: "wrench.and.screwdriver.fill", accessibilityDescription: "General Preferences")
systemSymbolName: "wrench.and.screwdriver.fill", accessibilityDescription: "General Preferences"
)
} else {
item.image = NSImage(named: NSImage.homeTemplateName)
}
@ -399,7 +400,8 @@ extension ctlPrefWindow: NSToolbarDelegate {
item.label = title
if #available(macOS 11.0, *) {
item.image = NSImage(
systemSymbolName: "person.fill.questionmark", accessibilityDescription: "Experiences Preferences")
systemSymbolName: "person.fill.questionmark", accessibilityDescription: "Experiences Preferences"
)
} else {
item.image = NSImage(named: NSImage.flowViewTemplateName)
}
@ -410,7 +412,8 @@ extension ctlPrefWindow: NSToolbarDelegate {
item.label = title
if #available(macOS 11.0, *) {
item.image = NSImage(
systemSymbolName: "character.book.closed.fill", accessibilityDescription: "Dictionary Preferences")
systemSymbolName: "character.book.closed.fill", accessibilityDescription: "Dictionary Preferences"
)
} else {
item.image = NSImage(named: NSImage.bookmarksTemplateName)
}

View File

@ -57,7 +57,7 @@ import Cocoa
)
}
@IBAction func btnWebsite(_ sender: NSButton) {
@IBAction func btnWebsite(_: NSButton) {
if let url = URL(string: "https://vchewing.github.io/") {
NSWorkspace.shared.open(url)
}

View File

@ -357,7 +357,7 @@ extension String {
extension vChewing.LMAssociates {
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: " ")
if neta.count >= 2 {
let theKey = String(neta[0])