feat(typing): add English autocomplete and Chinese candidate expand panel
Offline English lexicon suggestions with autocapitalization, plus a same-height Chinese more-candidates grid over the key area.
This commit is contained in:
@@ -137,16 +137,26 @@ struct KeyboardTopControls: View {
|
||||
case .voice:
|
||||
state.setSurface(.voice)
|
||||
case .chinese:
|
||||
let raw = typing.setLanguage(.chinese)
|
||||
if !raw.isEmpty { onInsert(raw) }
|
||||
applyTypingOutput(typing.setLanguage(.chinese))
|
||||
state.setSurface(.typing)
|
||||
case .english:
|
||||
let raw = typing.setLanguage(.english)
|
||||
if !raw.isEmpty { onInsert(raw) }
|
||||
applyTypingOutput(typing.setLanguage(.english))
|
||||
state.setSurface(.typing)
|
||||
}
|
||||
}
|
||||
|
||||
private func applyTypingOutput(_ output: TypingOutput) {
|
||||
if output.deleteCount > 0 {
|
||||
// Language switch rarely deletes; keep insert-only path for capsule.
|
||||
}
|
||||
guard !output.text.isEmpty else {
|
||||
typing.syncAutocapitalization()
|
||||
return
|
||||
}
|
||||
onInsert(output.text)
|
||||
typing.syncAutocapitalization()
|
||||
}
|
||||
|
||||
private func accessibilityLabel(for tab: KeyboardInputTab) -> String {
|
||||
switch tab {
|
||||
case .voice: return "切换到语音输入"
|
||||
|
||||
Reference in New Issue
Block a user