feat(desktop): built-in Han/Eng layout auto-switching, terminal/Vim support, and Unicode input
This commit is contained in:
parent
1da04b9e46
commit
a3ac44da2b
109 changed files with 8234 additions and 242 deletions
|
|
@ -168,6 +168,9 @@ async function initConfigEffects(): Promise<void> {
|
|||
effects.register('theme', () => reapplyThemeToAllPopups())
|
||||
// 팝업 문서 lang 도 같은 재주입에서 맞춘다
|
||||
effects.register('language', () => reapplyThemeToAllPopups())
|
||||
// 자동 한영·오타 교정이나 제안 설정이 바뀌면 입력 문맥 관찰기 실행 여부도 동기화한다
|
||||
effects.register('typoAutoCorrectEnabled', () => getInputTelemetryService().applyConfig())
|
||||
effects.register('suggestionEnabled', () => getInputTelemetryService().applyConfig())
|
||||
effects.start()
|
||||
getShutdownRegistry().register({ name: 'config-effects', dispose: () => effects.dispose() })
|
||||
}
|
||||
|
|
@ -213,9 +216,18 @@ async function initInputIntelligence(): Promise<void> {
|
|||
// 스냅샷이 온다), 모델로 검사 중이면 끝날 때('settled') 넘긴다. 제안이 고친 문장을 기준으로
|
||||
// 만들어지고, 두 요청이 같은 모델을 두고 경쟁하지 않는다.
|
||||
const typo = initTypoCorrectionService({
|
||||
replaceBeforeCaret: async (deleteCount, text) => {
|
||||
const method = configGet('insertMethod') === 'keyboard' ? 'keyboard' : 'clipboard'
|
||||
const result = await getTextInsertService().replaceBeforeCaret(deleteCount, text, method)
|
||||
replaceBeforeCaret: async (deleteCount, text, options) => {
|
||||
// Windows 에서는 KEYEVENTF_UNICODE 직접 타이핑('keyboard')을 기본으로 써서
|
||||
// 사용자의 클립보드(Win+V)를 오염시키거나 ClipboardSvcGroup 의 OpenClipboard 잠금과 충돌하지 않게 한다.
|
||||
const method = process.platform === 'win32' || configGet('insertMethod') === 'keyboard' ? 'keyboard' : 'clipboard'
|
||||
const baseLength = telemetry.currentTerminalPrefixLength()
|
||||
if (method === 'keyboard') {
|
||||
telemetry.expectProgrammaticKeys(deleteCount + (options?.commitComposition ? 2 : 0))
|
||||
}
|
||||
const result = await getTextInsertService().replaceBeforeCaret(deleteCount, text, method, options)
|
||||
if (result.success) {
|
||||
telemetry.applyProgrammaticReplacement(deleteCount, text, baseLength)
|
||||
}
|
||||
return result.success
|
||||
},
|
||||
lastKeyAt: () => telemetry.lastKeyAt,
|
||||
|
|
@ -237,12 +249,13 @@ async function initInputIntelligence(): Promise<void> {
|
|||
typo.on('corrected', () => {
|
||||
if (suggestion.isPresentationActive) suggestion.dismiss('stale')
|
||||
})
|
||||
// 제안이 켜져 있으면 오타를 조용히 고치지 않고 제안 창에 "지운 글자 → 고친 글자" 로 함께 내놓는다
|
||||
// (수락할 때만 적용 — 2026-10-17 사용자 요청). 제안이 꺼져 있을 때만 위 자동 교정이 돈다.
|
||||
// 제안이 켜져 있을 때도 한영 전환(Araso 방식 영→한·한→영·혼합어)은 기본 기능으로 즉시 고치고,
|
||||
// 일반 철자·모델 오타는 제안 창에 "지운 글자 → 고친 글자" 로 함께 내놓는다.
|
||||
suggestion.setTypoProposer({ propose: (context, signal, options) => typo.propose(context, signal, options) })
|
||||
telemetry.on('typed-context', (context) => {
|
||||
if (suggestion.isEnabled()) {
|
||||
suggestion.handleTypingContext(context)
|
||||
const layoutVerdict = typo.handleTypingContext(context, { layoutOnly: true })
|
||||
if (layoutVerdict === 'pass') suggestion.handleTypingContext(context)
|
||||
return
|
||||
}
|
||||
const verdict = typo.handleTypingContext(context)
|
||||
|
|
@ -285,6 +298,7 @@ async function initInputIntelligence(): Promise<void> {
|
|||
getKeyBindingService().on('triggered', (payload) => {
|
||||
if (payload.type !== 'pressed') return
|
||||
if (payload.actionId === 'suggestion-accept') void suggestion.accept()
|
||||
else if (payload.actionId === 'suggestion-accept-word') void suggestion.accept(undefined, { wordOnly: true })
|
||||
else if (payload.actionId === 'suggestion-next') suggestion.next()
|
||||
else if (payload.actionId === 'suggestion-prev') suggestion.previous()
|
||||
else if (payload.actionId === 'suggestion-dismiss') suggestion.dismiss('dismissed')
|
||||
|
|
@ -357,6 +371,8 @@ async function initAutoLaunch(): Promise<void> {
|
|||
async function initAutoUpdate(): Promise<void> {
|
||||
const { getUpdateService } = await import('./services/UpdateService')
|
||||
const updates = getUpdateService()
|
||||
// 설정 정보 탭·타이틀바 칩이 업데이트 진행을 따라가게 한다
|
||||
updates.on('status-changed', (status) => sendToMainWindow(IPC_CHANNELS.APP_UPDATE.STATUS_CHANGED, status))
|
||||
updates.initialize()
|
||||
getShutdownRegistry().register({ name: 'auto-update', dispose: () => updates.dispose() })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue