Repo // Remove useless do{} wrappers.
This commit is contained in:
parent
09cf014dca
commit
66f37fbb43
|
@ -154,20 +154,16 @@ extension KeyHandler {
|
|||
if input.isLeft {
|
||||
switch ctlCandidateCurrent.currentLayout {
|
||||
case .horizontal:
|
||||
do {
|
||||
if !ctlCandidateCurrent.highlightPreviousCandidate() {
|
||||
IME.prtDebugIntel("1145148D")
|
||||
errorCallback()
|
||||
}
|
||||
}
|
||||
case .vertical:
|
||||
do {
|
||||
if !ctlCandidateCurrent.showPreviousPage() {
|
||||
IME.prtDebugIntel("1919810D")
|
||||
errorCallback()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -187,20 +183,16 @@ extension KeyHandler {
|
|||
if input.isRight {
|
||||
switch ctlCandidateCurrent.currentLayout {
|
||||
case .horizontal:
|
||||
do {
|
||||
if !ctlCandidateCurrent.highlightNextCandidate() {
|
||||
IME.prtDebugIntel("9B65138D")
|
||||
errorCallback()
|
||||
}
|
||||
}
|
||||
case .vertical:
|
||||
do {
|
||||
if !ctlCandidateCurrent.showNextPage() {
|
||||
IME.prtDebugIntel("9244908D")
|
||||
errorCallback()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -220,20 +212,16 @@ extension KeyHandler {
|
|||
if input.isUp {
|
||||
switch ctlCandidateCurrent.currentLayout {
|
||||
case .horizontal:
|
||||
do {
|
||||
if !ctlCandidateCurrent.showPreviousPage() {
|
||||
IME.prtDebugIntel("9B614524")
|
||||
errorCallback()
|
||||
}
|
||||
}
|
||||
case .vertical:
|
||||
do {
|
||||
if !ctlCandidateCurrent.highlightPreviousCandidate() {
|
||||
IME.prtDebugIntel("ASD9908D")
|
||||
errorCallback()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -242,20 +230,16 @@ extension KeyHandler {
|
|||
if input.isDown {
|
||||
switch ctlCandidateCurrent.currentLayout {
|
||||
case .horizontal:
|
||||
do {
|
||||
if !ctlCandidateCurrent.showNextPage() {
|
||||
IME.prtDebugIntel("92B990DD")
|
||||
errorCallback()
|
||||
}
|
||||
}
|
||||
case .vertical:
|
||||
do {
|
||||
if !ctlCandidateCurrent.highlightNextCandidate() {
|
||||
IME.prtDebugIntel("6B99908D")
|
||||
errorCallback()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -81,11 +81,9 @@ extension KeyHandler {
|
|||
case 0:
|
||||
tooltipParameterRef[1] = compositor.readings[compositorCursorIndex]
|
||||
default:
|
||||
do {
|
||||
tooltipParameterRef[0] = compositor.readings[compositorCursorIndex - 1]
|
||||
tooltipParameterRef[1] = compositor.readings[compositorCursorIndex]
|
||||
}
|
||||
}
|
||||
/// 注音轉拼音
|
||||
for (i, _) in tooltipParameterRef.enumerated() {
|
||||
if tooltipParameterRef[i].isEmpty { continue }
|
||||
|
|
|
@ -32,25 +32,19 @@ let kConnectionName = "vChewing_1_Connection"
|
|||
switch max(CommandLine.arguments.count - 1, 0) {
|
||||
case 0: break
|
||||
case 1, 2:
|
||||
do {
|
||||
switch CommandLine.arguments[1] {
|
||||
case "install":
|
||||
do {
|
||||
if CommandLine.arguments[1] == "install" {
|
||||
let exitCode = IME.registerInputMethod()
|
||||
exit(exitCode)
|
||||
}
|
||||
}
|
||||
case "uninstall":
|
||||
do {
|
||||
if CommandLine.arguments[1] == "uninstall" {
|
||||
let exitCode = IME.uninstall(isSudo: IME.isSudoMode)
|
||||
exit(exitCode)
|
||||
}
|
||||
}
|
||||
default: break
|
||||
}
|
||||
}
|
||||
exit(0)
|
||||
default: exit(0)
|
||||
}
|
||||
|
|
|
@ -162,7 +162,6 @@ private class vwrCandidateUniversal: NSView {
|
|||
|
||||
switch isVerticalLayout {
|
||||
case true:
|
||||
do {
|
||||
var accuHeight: CGFloat = 0
|
||||
for (index, elementHeight) in elementHeights.enumerated() {
|
||||
let currentHeight = elementHeight
|
||||
|
@ -230,9 +229,7 @@ private class vwrCandidateUniversal: NSView {
|
|||
)
|
||||
accuHeight += currentHeight
|
||||
}
|
||||
}
|
||||
case false:
|
||||
do {
|
||||
var accuWidth: CGFloat = 0
|
||||
for (index, elementWidth) in elementWidths.enumerated() {
|
||||
let currentWidth = elementWidth
|
||||
|
@ -304,7 +301,6 @@ private class vwrCandidateUniversal: NSView {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func findHitIndex(event: NSEvent) -> Int {
|
||||
let location = convert(event.locationInWindow, to: nil)
|
||||
|
@ -313,7 +309,6 @@ private class vwrCandidateUniversal: NSView {
|
|||
}
|
||||
switch isVerticalLayout {
|
||||
case true:
|
||||
do {
|
||||
var accuHeight: CGFloat = 0.0
|
||||
for (index, elementHeight) in elementHeights.enumerated() {
|
||||
let currentHeight = elementHeight
|
||||
|
@ -323,9 +318,7 @@ private class vwrCandidateUniversal: NSView {
|
|||
}
|
||||
accuHeight += currentHeight
|
||||
}
|
||||
}
|
||||
case false:
|
||||
do {
|
||||
var accuWidth: CGFloat = 0.0
|
||||
for (index, elementWidth) in elementWidths.enumerated() {
|
||||
let currentWidth = elementWidth
|
||||
|
@ -336,7 +329,6 @@ private class vwrCandidateUniversal: NSView {
|
|||
accuWidth += currentWidth + 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
return NSNotFound
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue