InputHander // Show tooltip for standalone intonation marks.
This commit is contained in:
parent
ce611799dc
commit
6963784e59
|
@ -167,12 +167,14 @@ public class NSAttributedTooltipTextView: NSAttributedTextView {
|
||||||
text = text.replacingOccurrences(of: "Command", with: "⌘")
|
text = text.replacingOccurrences(of: "Command", with: "⌘")
|
||||||
text = text.replacingOccurrences(of: "Delete", with: "⌦")
|
text = text.replacingOccurrences(of: "Delete", with: "⌦")
|
||||||
text = text.replacingOccurrences(of: "BackSpace", with: "⌫")
|
text = text.replacingOccurrences(of: "BackSpace", with: "⌫")
|
||||||
|
text = text.replacingOccurrences(of: "Space", with: "␣")
|
||||||
text = text.replacingOccurrences(of: "SHIFT", with: "⇧")
|
text = text.replacingOccurrences(of: "SHIFT", with: "⇧")
|
||||||
text = text.replacingOccurrences(of: "CONTROL", with: "⌃")
|
text = text.replacingOccurrences(of: "CONTROL", with: "⌃")
|
||||||
text = text.replacingOccurrences(of: "ENTER", with: "⏎")
|
text = text.replacingOccurrences(of: "ENTER", with: "⏎")
|
||||||
text = text.replacingOccurrences(of: "COMMAND", with: "⌘")
|
text = text.replacingOccurrences(of: "COMMAND", with: "⌘")
|
||||||
text = text.replacingOccurrences(of: "DELETE", with: "⌦")
|
text = text.replacingOccurrences(of: "DELETE", with: "⌦")
|
||||||
text = text.replacingOccurrences(of: "BACKSPACE", with: "⌫")
|
text = text.replacingOccurrences(of: "BACKSPACE", with: "⌫")
|
||||||
|
text = text.replacingOccurrences(of: "SPACE", with: "␣")
|
||||||
}
|
}
|
||||||
if areaCalculation {
|
if areaCalculation {
|
||||||
text = text.replacingOccurrences(
|
text = text.replacingOccurrences(
|
||||||
|
|
|
@ -184,7 +184,11 @@ extension InputHandler {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// 以回呼組字狀態的方式來執行 setInlineDisplayWithCursor()。
|
// 以回呼組字狀態的方式來執行 setInlineDisplayWithCursor()。
|
||||||
delegate.switchState(generateStateOfInputting())
|
var resultState = generateStateOfInputting()
|
||||||
|
resultState.tooltip = tooltipForStandaloneIntonationMark
|
||||||
|
resultState.tooltipDuration = 0
|
||||||
|
resultState.data.tooltipColorState = .prompt
|
||||||
|
delegate.switchState(resultState)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -68,7 +68,21 @@ extension InputHandler {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 生成「正在輸入」狀態。
|
/// 生成「在有單獨的前置聲調符號輸入時」的工具提示。
|
||||||
|
var tooltipForStandaloneIntonationMark: String {
|
||||||
|
guard !isComposerUsingPinyin else { return "" }
|
||||||
|
guard composer.hasIntonation(withNothingElse: true) else { return "" }
|
||||||
|
guard composer.intonation.value != " " else { return "" }
|
||||||
|
let result = NSMutableString()
|
||||||
|
result.append("Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer.".localized)
|
||||||
|
if prefs.acceptLeadingIntonations {
|
||||||
|
result.append("\n")
|
||||||
|
result.append("It will attempt to combine with the incoming phonabet input.".localized)
|
||||||
|
}
|
||||||
|
return result.description
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 將組字器內的游標位置資料轉換成可以正確顯示的游標位置資料。
|
||||||
/// - Parameter rawCursor: 原始游標。
|
/// - Parameter rawCursor: 原始游標。
|
||||||
/// - Returns: 用以顯示的游標。
|
/// - Returns: 用以顯示的游標。
|
||||||
func convertCursorForDisplay(_ rawCursor: Int) -> Int {
|
func convertCursorForDisplay(_ rawCursor: Int) -> Int {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"vChewing" = "vChewing";
|
"vChewing" = "vChewing";
|
||||||
|
"It will attempt to combine with the incoming phonabet input." = "It will attempt to combine with the incoming phonabet input.";
|
||||||
|
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer.";
|
||||||
"CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch";
|
"CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch";
|
||||||
"Switch to %@ Input Mode" = "Switch to %@ Input Mode";
|
"Switch to %@ Input Mode" = "Switch to %@ Input Mode";
|
||||||
"Target Input Mode Activation Required" = "Target Input Mode Activation Required";
|
"Target Input Mode Activation Required" = "Target Input Mode Activation Required";
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"vChewing" = "vChewing";
|
"vChewing" = "vChewing";
|
||||||
|
"It will attempt to combine with the incoming phonabet input." = "It will attempt to combine with the incoming phonabet input.";
|
||||||
|
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer.";
|
||||||
"CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch";
|
"CHS / CHT Input Mode Switch" = "CHS / CHT Input Mode Switch";
|
||||||
"Switch to %@ Input Mode" = "Switch to %@ Input Mode";
|
"Switch to %@ Input Mode" = "Switch to %@ Input Mode";
|
||||||
"Target Input Mode Activation Required" = "Target Input Mode Activation Required";
|
"Target Input Mode Activation Required" = "Target Input Mode Activation Required";
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"vChewing" = "威注音入力アプリ";
|
"vChewing" = "威注音入力アプリ";
|
||||||
|
"It will attempt to combine with the incoming phonabet input." = "この音調は次の注音入力と組み合わす。";
|
||||||
|
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "音調記号。ENTER で送り出す。\nSPACE で入力緩衝列に挿入。";
|
||||||
"CHS / CHT Input Mode Switch" = "簡体・繁体中国語入力の切り替え";
|
"CHS / CHT Input Mode Switch" = "簡体・繁体中国語入力の切り替え";
|
||||||
"Switch to %@ Input Mode" = "%@入力モードに切り替え";
|
"Switch to %@ Input Mode" = "%@入力モードに切り替え";
|
||||||
"Target Input Mode Activation Required" = "関連の入力ソースの追加が必要";
|
"Target Input Mode Activation Required" = "関連の入力ソースの追加が必要";
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"vChewing" = "威注音输入法";
|
"vChewing" = "威注音输入法";
|
||||||
|
"It will attempt to combine with the incoming phonabet input." = "该声调亦会尝试与接下来输入的注音相组合。";
|
||||||
|
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "声调符号。敲 Enter 以递交。\n敲空格键以插入组字区。";
|
||||||
"CHS / CHT Input Mode Switch" = "简体/繁体中文输入模式切换";
|
"CHS / CHT Input Mode Switch" = "简体/繁体中文输入模式切换";
|
||||||
"Switch to %@ Input Mode" = "切换至%@输入模式";
|
"Switch to %@ Input Mode" = "切换至%@输入模式";
|
||||||
"Target Input Mode Activation Required" = "得启用对应的「輸入法」";
|
"Target Input Mode Activation Required" = "得启用对应的「輸入法」";
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"vChewing" = "威注音輸入法";
|
"vChewing" = "威注音輸入法";
|
||||||
|
"It will attempt to combine with the incoming phonabet input." = "該聲調亦會嘗試與接下來輸入的注音相組合。";
|
||||||
|
"Intonation mark. ENTER to commit.\nSPACE to insert into composition buffer." = "聲調符號。敲 Enter 以遞交。\n敲空格鍵以插入組字區。";
|
||||||
"CHS / CHT Input Mode Switch" = "簡體/繁體中文輸入模式切換";
|
"CHS / CHT Input Mode Switch" = "簡體/繁體中文輸入模式切換";
|
||||||
"Switch to %@ Input Mode" = "切換至%@輸入模式";
|
"Switch to %@ Input Mode" = "切換至%@輸入模式";
|
||||||
"Target Input Mode Activation Required" = "得啟用對應的「輸入方式」";
|
"Target Input Mode Activation Required" = "得啟用對應的「輸入方式」";
|
||||||
|
|
Loading…
Reference in New Issue