fix(desktop): prevent Korean character swallowing in terminal and xterm.js surfaces (INPUT-04, INPUT-19)
This commit is contained in:
parent
f18cebaa24
commit
61123b5ad8
11 changed files with 264 additions and 50 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
|
@ -12,6 +12,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Additional Whisper model management UI
|
||||
- Plugin system for custom pipelines
|
||||
|
||||
## [1.15.1] - 2026-10-31
|
||||
|
||||
> Published from an annotated tag. Installer and update metadata are served by the
|
||||
> canonical Forgejo feed; no binaries are committed to this repository.
|
||||
|
||||
### Fixed
|
||||
- **Terminal & `xterm.js` Korean IME character-swallowing fix (터미널·에이전트 창 한글 타이핑 시 1글자씩 씹히는 현상 근본 해결).**
|
||||
- Removes synchronous cross-process `isForegroundKoreanIme` (`SendMessageTimeoutW(WM_IME_CONTROL)`) calls from the low-level keydown hook (`InputTelemetryService._handleKeyDown`) that were disrupting Windows TSF/DefIME composition state on every keystroke in terminal windows, replacing them with a one-time idle-snapshot IME sync (`TerminalKeystrokeTracker.syncKoreanIme`).
|
||||
- Adds a dedicated `xterm-helper-textarea` fast path in `sidecar/uia_bridge.py` that skips `GetTopLevelControl()` DOM tree walks and `TextPattern.GetSelection()` / `ExpandToEnclosingUnit(Character)` / `TextEditPattern.GetActiveComposition()` COM calls (which stalled Chromium's renderer thread up to 1,500 ms during Korean IME composition and left `isComposing` stuck `true`), and extends `_WAKE_TTL_SECONDS` from 60 s to 86,400 s per HWND.
|
||||
- Suppresses 40 ms word-boundary UIA snapshots on normal Korean words (`_shouldRunFastTerminalBoundarySnapshot`), removes the duplicate 680 ms `_typoTimer`, and stops 800 ms `_sampleWhileTyping` polling on terminal surfaces so UIA never queries `xterm-helper-textarea` while you press the first consonant of the next word.
|
||||
- Prevents `TypoCorrectionService` from injecting `commitComposition` (`VK_SPACE` + `VK_BACK`) on trailing composed Hangul syllables (`/[가-힣]$/u`) in terminals before `Space` is pressed.
|
||||
|
||||
## [1.15.0] - 2026-10-31
|
||||
|
||||
> Published from an annotated tag. Installer and update metadata are served by the
|
||||
|
|
|
|||
|
|
@ -251,7 +251,41 @@ def _caret_rect_and_offset(auto: Any, control: Any) -> tuple[Optional[dict], Opt
|
|||
|
||||
|
||||
_woken_hwnds: dict[int, float] = {}
|
||||
_WAKE_TTL_SECONDS = 60.0
|
||||
_WAKE_TTL_SECONDS = 86400.0
|
||||
|
||||
|
||||
def _foreground_window_meta() -> tuple[Optional[str], Optional[dict]]:
|
||||
"""Win32 API 로 포그라운드 창 제목과 사각형을 즉시 읽는다 (UIA 부모 트리 순회 COM 호출 제거)."""
|
||||
try:
|
||||
import ctypes # noqa: PLC0415
|
||||
from ctypes import wintypes # noqa: PLC0415
|
||||
|
||||
user32 = ctypes.windll.user32
|
||||
hwnd = int(user32.GetForegroundWindow() or 0)
|
||||
if not hwnd:
|
||||
return (None, None)
|
||||
|
||||
title: Optional[str] = None
|
||||
buf = ctypes.create_unicode_buffer(302)
|
||||
length = int(user32.GetWindowTextW(wintypes.HWND(hwnd), buf, 300) or 0)
|
||||
if length > 0:
|
||||
title = buf.value[:300]
|
||||
|
||||
rect = wintypes.RECT()
|
||||
rect_dict: Optional[dict] = None
|
||||
if user32.GetWindowRect(wintypes.HWND(hwnd), ctypes.byref(rect)):
|
||||
width = int(rect.right) - int(rect.left)
|
||||
height = int(rect.bottom) - int(rect.top)
|
||||
if width >= 0 and height >= 0:
|
||||
rect_dict = {
|
||||
"x": int(rect.left),
|
||||
"y": int(rect.top),
|
||||
"width": width,
|
||||
"height": height,
|
||||
}
|
||||
return (title, rect_dict)
|
||||
except Exception:
|
||||
return (None, None)
|
||||
|
||||
|
||||
def _wake_chromium_accessibility(force: bool = False) -> bool:
|
||||
|
|
@ -366,13 +400,29 @@ def _snapshot() -> dict:
|
|||
except Exception:
|
||||
result["processId"] = None
|
||||
|
||||
try:
|
||||
top = control.GetTopLevelControl()
|
||||
if top is not None:
|
||||
result["windowTitle"] = str(top.Name or "")[:300]
|
||||
result["elementRect"] = _rect_to_dict(top.BoundingRectangle) or result["elementRect"]
|
||||
except Exception:
|
||||
pass
|
||||
fg_title, fg_rect = _foreground_window_meta()
|
||||
if fg_title:
|
||||
result["windowTitle"] = fg_title
|
||||
if fg_rect is not None:
|
||||
result["elementRect"] = fg_rect
|
||||
|
||||
class_name_lower = str(result["className"] or "").lower()
|
||||
control_name_lower = str(result["controlName"] or "").strip().lower()
|
||||
is_xterm_helper = (
|
||||
"xterm-helper-textarea" in class_name_lower
|
||||
or control_name_lower in ("terminal input", "터미널 입력")
|
||||
)
|
||||
|
||||
if not is_xterm_helper and (result["windowTitle"] is None or result["elementRect"] is None):
|
||||
try:
|
||||
top = control.GetTopLevelControl()
|
||||
if top is not None:
|
||||
if result["windowTitle"] is None:
|
||||
result["windowTitle"] = str(top.Name or "")[:300]
|
||||
if result["elementRect"] is None:
|
||||
result["elementRect"] = _rect_to_dict(top.BoundingRectangle) or result["elementRect"]
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
result["elementRect"] = _rect_to_dict(control.BoundingRectangle) or result["elementRect"]
|
||||
|
|
@ -383,6 +433,19 @@ def _snapshot() -> dict:
|
|||
result["textSource"] = source
|
||||
result["text"] = text
|
||||
|
||||
if is_xterm_helper:
|
||||
# xterm.js 의 숨김 IME 입력창(xterm-helper-textarea)에서 TextPattern 선택·문자 확장·TextEditPattern
|
||||
# 조합 조회를 호출하면 Chromium 렌더러 스레드가 블로킹(최대 1500ms 타임아웃)되고 한글 조합 중인
|
||||
# 글자가 삼켜진다. ValuePattern 값과 편집 가능 여부만 즉시 반환한다.
|
||||
result["isEditable"] = True
|
||||
result["caretRect"] = None
|
||||
result["caretOffset"] = None
|
||||
result["isComposing"] = False
|
||||
result["hasSelection"] = False
|
||||
result["capturedAt"] = int(time.time() * 1000)
|
||||
result["elapsedMs"] = int((time.monotonic() - started) * 1000)
|
||||
return result
|
||||
|
||||
is_readonly = False
|
||||
try:
|
||||
if value_pattern is not None:
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ import {
|
|||
type TerminalVimMode
|
||||
} from '@d3ro/core/input-intelligence'
|
||||
import { RecentWritesBuffer, type RecentWrite, type RecentWriteMeta } from '@d3ro/core/recent-writes'
|
||||
import { detectTypos } from '@d3ro/core/typo-correction'
|
||||
import { getDatabase } from '../db'
|
||||
import { inputActivity, personalPhrases, suggestions as suggestionsTable, typingSamples } from '../db/schema'
|
||||
import { configGet, configSet } from './ConfigService'
|
||||
|
|
@ -595,13 +596,10 @@ class InputTelemetryService extends EventEmitter {
|
|||
// 진단: 키 값이 아니라 종류·수정자만 남긴다 (typed 판정이 왜 틀리는지 로그로 보이게)
|
||||
this._lastKeyDiag = `${keyClass}${vk === null ? `?${event.keycode}` : ''}${this._modifiers.ctrl ? '+C' : ''}${this._modifiers.alt ? '+A' : ''}${this._modifiers.meta ? '+M' : ''}`
|
||||
|
||||
// 터미널·Vim·개발 표면에서는 키스트로크 버퍼와 IME 상태를 함께 추적해
|
||||
// 줄 끝 공백 손실(Windows Terminal)이나 캔버스 터미널(len=0)에서도 한영 자동 전환과 Vim 모드가 동작하게 한다.
|
||||
const onTerminalSurface = isTerminalOrDeveloperSurface(this._foreground.appName)
|
||||
const koreanIme =
|
||||
onTerminalSurface && vk !== null && vk >= 0x41 && vk <= 0x5a
|
||||
? isForegroundKoreanIme(this._foreground.hwnd)
|
||||
: undefined
|
||||
// 터미널·Vim·개발 표면에서는 키스트로크 버퍼를 추적해 줄 끝 공백 손실(Windows Terminal)이나
|
||||
// 캔버스 터미널(len=0)에서도 한영 자동 전환과 Vim 모드가 동작하게 한다.
|
||||
// 주의: 키다운 훅 안에서 대상 창 IME 에 동기 WM_IME_CONTROL(isForegroundKoreanIme)을 보내면
|
||||
// TSF/Cicero 조합 상태가 깨져 한글이 한 글자씩 씹히므로 훅 안에서는 절대 호출하지 않는다.
|
||||
this._terminalTracker.onKeyDown({
|
||||
hwnd: this._foreground.hwnd,
|
||||
windowTitle: this._foreground.windowTitle,
|
||||
|
|
@ -611,7 +609,6 @@ class InputTelemetryService extends EventEmitter {
|
|||
ctrl: this._modifiers.ctrl,
|
||||
alt: this._modifiers.alt,
|
||||
meta: this._modifiers.meta,
|
||||
koreanIme,
|
||||
now: this._lastKeyAt
|
||||
})
|
||||
|
||||
|
|
@ -769,13 +766,19 @@ class InputTelemetryService extends EventEmitter {
|
|||
private async _sampleWhileTyping(): Promise<void> {
|
||||
if (!this._running || this._sampling) return
|
||||
const now = Date.now()
|
||||
if (!this._suggestionPresentationActive && this._lastKeyAt > 0 && now - this._lastKeyAt < 350) {
|
||||
if (this._lastKeyAt > 0 && now - this._lastKeyAt < 1000) {
|
||||
return
|
||||
}
|
||||
if (
|
||||
!this._suggestionPresentationActive &&
|
||||
(isTerminalOrDeveloperSurface(this._foreground.appName) ||
|
||||
this._lastContext?.terminalMode === true ||
|
||||
this._lastKeyAt === 0 ||
|
||||
now - this._lastKeyAt > INPUT_TELEMETRY_DEFAULTS.sampleActiveWindowMs ||
|
||||
(this._lastContext !== null && this._lastContext.capturedAt >= this._lastKeyAt))
|
||||
) {
|
||||
return
|
||||
}
|
||||
const hasRecentKeyboardInput =
|
||||
this._lastKeyAt > 0 &&
|
||||
now - this._lastKeyAt <= INPUT_TELEMETRY_DEFAULTS.sampleActiveWindowMs
|
||||
if (!hasRecentKeyboardInput && !this._suggestionPresentationActive) return
|
||||
|
||||
this._sampling = true
|
||||
try {
|
||||
|
|
@ -785,26 +788,45 @@ class InputTelemetryService extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
private _shouldRunFastTerminalBoundarySnapshot(): boolean {
|
||||
if (!isTerminalOrDeveloperSurface(this._foreground.appName)) return true
|
||||
const tracked = this._terminalTracker.currentPrefix()
|
||||
if (tracked.trim().length === 0) return true
|
||||
if (/[ㄱ-ㅎㅏ-ㅣA-Za-z]/u.test(tracked) || tracked.trimStart().startsWith(':')) {
|
||||
return true
|
||||
}
|
||||
return (
|
||||
detectTypos(tracked, {
|
||||
includeTrailingToken: true,
|
||||
layoutOnly: true,
|
||||
terminalMode: true
|
||||
}).length > 0
|
||||
)
|
||||
}
|
||||
|
||||
private _scheduleTextSnapshot(keyClass?: KeyStrokeClass): void {
|
||||
// Araso 급 빠른 한영 전환: 공백·문장부호 직후에는 40ms 뒤에 즉시 스냅샷을 찍고,
|
||||
// 일반 글자 입력 중에는 단어를 치는 도중(예: sometime 의 some 시점) 끼어들어 글자를 삼키지 않도록
|
||||
// 680ms 유휴 뒤에 스냅샷을 찍는다(Vim 명령줄 :wq 등은 160ms).
|
||||
// 700ms 디바운스 타이머(_textTimer)에 맡긴다(Vim 명령줄 :wq 등은 160ms).
|
||||
if (this._typoTimer) clearTimeout(this._typoTimer)
|
||||
if (keyClass && TYPING_KEY_CLASSES.has(keyClass) && configGet('typoAutoCorrectEnabled') !== false) {
|
||||
const isBoundaryKey =
|
||||
keyClass === 'space' ||
|
||||
keyClass === 'symbol' ||
|
||||
(keyClass === 'digit' && this._modifiers.shift)
|
||||
const quickDelay = isBoundaryKey
|
||||
? 40
|
||||
: this._terminalTracker.vimMode === 'command'
|
||||
? 160
|
||||
: 680
|
||||
this._typoTimer = setTimeout(() => {
|
||||
this._typoTimer = null
|
||||
void this._captureTextSnapshot()
|
||||
}, quickDelay)
|
||||
this._typoTimer.unref?.()
|
||||
const quickDelay =
|
||||
isBoundaryKey && this._shouldRunFastTerminalBoundarySnapshot()
|
||||
? 40
|
||||
: !isBoundaryKey && this._terminalTracker.vimMode === 'command'
|
||||
? 160
|
||||
: null
|
||||
if (quickDelay !== null) {
|
||||
this._typoTimer = setTimeout(() => {
|
||||
this._typoTimer = null
|
||||
void this._captureTextSnapshot()
|
||||
}, quickDelay)
|
||||
this._typoTimer.unref?.()
|
||||
}
|
||||
}
|
||||
|
||||
if (this._textTimer) clearTimeout(this._textTimer)
|
||||
|
|
@ -898,6 +920,14 @@ class InputTelemetryService extends EventEmitter {
|
|||
typedRecently
|
||||
}
|
||||
|
||||
if (
|
||||
!snapshot.isPassword &&
|
||||
isTerminalOrDeveloperSurface(this._foreground.appName) &&
|
||||
!this._terminalTracker.hasObservedImeForHwnd(this._foreground.hwnd)
|
||||
) {
|
||||
this._terminalTracker.syncKoreanIme(isForegroundKoreanIme(this._foreground.hwnd))
|
||||
}
|
||||
|
||||
if (snapshot.available && isXtermHelperControl(snapshot) && !snapshot.isPassword) {
|
||||
const usesCaretRect = snapshot.caretRect !== null
|
||||
context.anchor = snapshot.caretRect ?? snapshot.elementRect
|
||||
|
|
|
|||
|
|
@ -2145,7 +2145,7 @@ export class SuggestionService extends EventEmitter {
|
|||
const anchor = this._anchor
|
||||
const anchorKind = this._anchorKind
|
||||
const provenance = this._provenance
|
||||
const composing = this._lastContext?.isComposing === true && /[가-힣]$/u.test(acceptPrefix)
|
||||
const composing = this._lastContext?.isComposing === true
|
||||
const appName = this._appName
|
||||
const windowTitle = this._windowTitle
|
||||
const targetWindow = this._windowHandle
|
||||
|
|
|
|||
|
|
@ -225,6 +225,12 @@ export class TypoCorrectionService extends EventEmitter {
|
|||
// 1단계(한영 전환 layoutOnly)는 단어 경계(25ms)와 어절 끝 유휴(650ms)에서 즉시 실행하고,
|
||||
// 2단계(철자 사전 + Gemma 배경 오타·한영 보정)는 터미널이 아니면서 유휴 조건을 충족했을 때 실행한다.
|
||||
const isTerminal = context.terminalMode === true || isTerminalApp(context.appName)
|
||||
// 터미널(xterm.js 등)에서 공백·문장부호 없이 완성형 한글 음절([가-힣])로 끝난 상태는
|
||||
// 아직 IME 조합 버퍼에 머물러 있어 PTY 로 전달되기 전일 수 있다. 이때 commitComposition(Space+Backspace)을
|
||||
// 주입하면 xterm.js 의 비동기 조합 확정과 백스페이스가 경합해 앞 글자를 삼키므로 단어 경계(Space 등)까지 기다린다.
|
||||
if (isTerminal && !hasTrailingBoundary && !isVimCommand && /[가-힣]$/u.test(prefix)) {
|
||||
return 'pass'
|
||||
}
|
||||
const suspicious = hasSuspiciousTypo(region)
|
||||
const minFullCheckIdle =
|
||||
hasTrailingBoundary && suspicious
|
||||
|
|
|
|||
|
|
@ -589,6 +589,40 @@ describe('TypoCorrectionService', () => {
|
|||
).toBe('pass')
|
||||
expect(fake.replaceBeforeCaret).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('터미널에서 공백 없이 끝난 한글 음절(예: ㅎ샤ㅗㅕㅠ에)은 조합 중 글자를 삼키지 않도록 공백 확정 전까지 치환하지 않는다', async () => {
|
||||
const fake = deps({ warmModel: () => null })
|
||||
const service = new TypoCorrectionService(fake.deps)
|
||||
|
||||
// 공백 전(조합 중인 마지막 음절 '에' 가 아직 xterm-helper-textarea 안에 있을 때)에는 건드리지 않는다.
|
||||
expect(
|
||||
service.handleTypingContext(
|
||||
typingContext({
|
||||
prefix: 'ㅎ샤ㅗㅕㅠ에',
|
||||
appName: 'Agent Switchboard.exe',
|
||||
terminalMode: true,
|
||||
isComposing: true,
|
||||
idleMs: 1200
|
||||
})
|
||||
)
|
||||
).toBe('pass')
|
||||
expect(fake.replaceBeforeCaret).not.toHaveBeenCalled()
|
||||
|
||||
// 공백으로 어절이 확정된 뒤('ㅎ샤ㅗㅕㅠ에 ')에는 'github에 ' 로 정상 치환한다.
|
||||
expect(
|
||||
service.handleTypingContext(
|
||||
typingContext({
|
||||
prefix: 'ㅎ샤ㅗㅕㅠ에 ',
|
||||
appName: 'Agent Switchboard.exe',
|
||||
terminalMode: true,
|
||||
isComposing: false,
|
||||
idleMs: 80
|
||||
})
|
||||
)
|
||||
).toBe('correcting')
|
||||
await flush()
|
||||
expect(fake.replaceBeforeCaret).toHaveBeenCalledWith('ㅎ샤ㅗㅕㅠ에 '.length, 'github에 ')
|
||||
})
|
||||
})
|
||||
|
||||
describe('TypoCorrectionService.propose — 제안 창에 함께 내놓을 교정 (적용하지 않음)', () => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
> Status: ACTIVE
|
||||
> Last full audit: 2026-09-13
|
||||
> Last update: 2026-10-31 — **v1.15.0 릴리스 + 다단계 명령 파이프라인 복수 선택·순서 조정 UI 및 단일 패스 합성 실행(`AI-05`, `AI-07`).** `@d3ro/core/instruction-template`에 복수 명령 파이프라인 직렬화·토글·순서 이동·프롬프트 합성(`parseActiveInstructionIds`, `serializeActiveInstructionIds`, `toggleInstructionInPipeline`, `moveInstructionInPipeline`, `composeInstructionPipelinePrompt`)을 추가하고, `CommandsPage.tsx`를 단일 라디오 선택에서 **순서가 있는 복수 선택(체크박스 + `1단계`/`2단계` 배지 + `↑`/`↓` 순서 이동 버튼 + 상단 단계별 파이프라인 요약 + 파이프라인 통합 테스트 실행)**으로 업그레이드했다. 예컨대 `1단계: 구어·추임새·중복 정리` → `2단계: 격식체 변환`을 함께 선택하면 후행 단계의 어투·출력 규칙이 우선 적용되는 합성 파이프라인 프롬프트로 지연 시간 증가 없이 한 번에 실행된다.
|
||||
> Last update: 2026-10-31 — **v1.15.1 릴리스 + 터미널·xterm.js 환경 한글 1글자씩 씹힘 근본 해결(`INPUT-04`, `INPUT-19`, `GAP-INPUT-08`, `GAP-INPUT-11`).** 터미널(`Agent Switchboard.exe` `xterm-helper-textarea`, `WindowsTerminal.exe`, `Kitedesk.exe`, `pwsh.exe`, `cmd.exe` 등)에서 한글 연속 타이핑 시 글자가 한 글자씩 씹히던 4가지 원인을 전수 제거했다: (1) `InputTelemetryService._handleKeyDown`에서 터미널 표면일 때 매 키다운마다 호출하던 크로스-프로세스 `isForegroundKoreanIme`(`SendMessageTimeoutW(WM_IME_CONTROL)`)가 Windows TSF/DefIME 조합 상태를 흔들던 문제를 제거하고 유휴 스냅샷 시점 1회 동기화(`TerminalKeystrokeTracker.syncKoreanIme`)로 전환, (2) `sidecar/uia_bridge.py`에서 `xterm-helper-textarea` 조회 시 Chromium 렌더러 메인 스레드를 최대 1,500ms 블로킹하고 `comp=True` 고착을 유발하던 `GetTopLevelControl()`·`TextPattern.GetSelection()`·`ExpandToEnclosingUnit(Character)`·`TextEditPattern.GetActiveComposition()` 호출을 건너뛰는 고속 경로 추가 및 `_WAKE_TTL_SECONDS` 60s→86,400s 연장, (3) 일반 한글 단어(`"근데 "`, `"터미널 "` 등) 입력 중 공백 직후 40ms 경계 스냅샷·680ms 중복 타이머·800ms 타이핑 중 폴링 억제(`_shouldRunFastTerminalBoundarySnapshot`, `_sampleWhileTyping`), (4) `TypoCorrectionService`에서 터미널의 공백 전 완성형 한글 음절(`[가-힣]$`)에 대해 `commitComposition`(`VK_SPACE`+`VK_BACK`) 주입을 원천 차단. 직전 같은 날 `v1.15.0`: `CommandsPage.tsx` 다단계 명령 파이프라인 복수 선택·순서 조정 UI 및 단일 패스 합성 실행(`AI-05`, `AI-07`).
|
||||
>
|
||||
> Previous update: 2026-10-30 — **백로그 26건 일괄 해소 (`GAP-INPUT-03`, `GAP-LLM-01`, `GAP-UX-01/02/03/05/06/07`, `GAP-I18N-01`, `GAP-REL-11/14/15`, `GAP-INFRA-01/02/04/06`, `GAP-OPS-01`, `GAP-QA-02`, `GAP-KEY-01/03`, `GAP-ADS-02`, `GAP-ID-01/02`, `GAP-TEAM-02`, `GAP-SHELL-01`, `GAP-PUSH-03`, `GAP-MTG-01`, `DOC-01`) + 입력 누락 검증 인프라 및 서비스 결함 재현(`INPUT-04/19`, `INFRA-20`, `GAP-INPUT-11`).** (1) **백로그 26건 해소:** CJK 무공백 어절 집계(`countWords`), 12개 번역 대상 언어 설정(`targetLanguage`), 12개 로케일 2,716개 키 100% 동기화(`sync-i18n-locales.mjs`), 데스크톱 strict 타입체크 0 에러(`tsconfig.node.json` + `tsconfig.web.json`), Forgejo 릴리스 태그 푸시 순서·SHA 고정(`GAP-REL-14`), 포터블 워크플로 매니페스트 검증(`GAP-REL-11`), 네이티브 ABI 스위처(`rebuild:app`/`rebuild:test`), Supabase 마이그레이션 정합성 검사기(`check:migrations`), NAS 배포 런북(`nas-deploy-runbook.md`), 오프라인 격리 테스트 하네스(`GAP-QA-02`), `KeyBindingService` 단위 테스트·`command` 전용 액션 핸들러, 데스크톱 광고 보상 쿼터 연동(`grantRewardQuota`), 회의 종료 후 메모 추가·노트패드 동기화, 이력 SQLite 커서 페이지네이션·인라인 편집·전체 내보내기, 회의 요약 `[MM:SS]` 타임스탬프 인용·클릭 시크 연동(데스크톱·웹·모바일), `resolveEntitlement` 정본 통일, 통합 검색(`UnifiedSearchService`) 취소·세그먼트 검색·페이로드 경량화, 웹 팀 초대 수락(`/app/accept-invite`), 관리자 고객지원 콘솔(`/support`), Web Push 서비스워커(`sw.js`)·iOS APNs 토큰 등록을 완료했다. (2) **입력 누락 검증 인프라(`GAP-INPUT-11`):** `typing-race-proof.mjs`가 체크아웃을 바꾸지 않고 3개 서비스만 HEAD `f49acf0`와 수정본으로 바꿔 같은 현재 의존성·시험에서 비교했다: HEAD 1/17, 수정본 17/17. 3개 문자열 손상 사례와 13개 스냅샷·메타데이터·조회 병합 계약 실패를 구분했고, 정상 교정 대조군은 양쪽 모두 통과했다. `typing-fixture`(scan-code·IME·CPU 부하)와 `typing-runtime`(별도 로컬 프로필·실제 제품 번들)을 준비했으며, 실제 GUI·IME·CPU·모델 cold/warm 시험은 아직 미실행이다. 증거: `test-results/typing-load/race-proof-2026-10-30T00-50-32-284Z/report.json`; 실행 명령은 `02` §3, 검증 경계는 `04` §6과 `11` GAP-INPUT-11.
|
||||
>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -107,7 +107,7 @@ Legend: `[ ]` open · `[~]` in progress · `[!]` blocked externally · `[x]` res
|
|||
| GAP-INPUT-06 | Input intelligence | `[~]` **제안 폭주 상한 및 runtime 확인.** 이전 24.7 s / 4.9 s, boot warmup, `keep_alive: 30m`, 48/96/128 tokens 및 2/5 candidates 기록은 역사적 가설/완화 이력이며 현재 정책이 아니다. 현 정책은 600 ms debounce, 5 s minimum interval, 6 requests/min default (hard max 12), 3 candidates, 64 output tokens, 12-character growth, 8 s timeout, `keep_alive: 2m` 및 boot warmup 제거다. | `apps/desktop/src/main/services/SuggestionService.ts`, `packages/core/src/input-intelligence.ts`, `LocalLLMService.ts` | 표적 자동 검증은 6 files / 69 passed / 0 failed이며 raw Ollama의 15.044 s cold timeout cleanup, 약 119.9 s residency expiry, 그리고 19:48:59 +09:00에 새 generate/unload/kill/retry 없이 확인한 `/api/ps` HTTP 200 / 45.8 ms / `{models:[]}` (`/api/version` HTTP 200 / 7.3 ms / `0.32.13`)도 확인됐다. 전체 strict typecheck는 green이 아니며, 이 raw API unload 증거는 앱 재시작·GUI·실제 자동제안 타이핑 검증이 아니다. 그 경로에서 rate limit, 8 s abort, 3-candidate/64-token 상한을 확인한다. |
|
||||
| GAP-INPUT-08 | Input intelligence | `[x]` **오타 자동 교정(INPUT-19) 일반 앱(8/8) + 터미널·Vim(6/6) 실앱 E2E 검증 및 xterm.js(`Agent Switchboard`) 재교정 루프 수정 완료 (2026-10-27); 문맥 제안(INPUT-20)은 GAP-INPUT-09 에서 추적.** 2026-10-26 에 `packages/core/src/araso-layout.ts` 및 `typo-correction.ts` 로 한영 혼합어(`githubdp`→`github에`, `PDFvkdlf`→`PDF파일`, `ㅖㅇㄹ파일`→`PDF파일`, `Reactzjavhsjsxm`→`React컴포넌트`), 쌍자음 잔여 Shift(`djEJs`→`어떤`, `qkRNjTdj`→`바꿨어`), 한→영 역변환(`ㅎ샤ㅗㅕㅠ에`→`github에`, `ㅑㄹ ㅑ 쇼ㅔㄷ ㅗ디ㅣㅐ 소두 ㅑㅅ 초뭏ㄷㄴ ㅑㅜ 10 ㄴㄷ채ㅜㅇㄴ`→`if I type hello then it changes in 10 seconds`), 문장 문맥 한영 전환(`Stay hungry, stay foolishsms wkqtmdml akfdlek.`), URL/경로 보호를 추가하고, 통계 수집 동의(`inputTelemetryEnabled`) 없이도 기본 기능으로 동작하도록 배선했다. 이어서 실제 Windows 인터랙티브 데스크톱(`WinSta0\Default`)에서 WinForms 테스트 창(`E2ETestBox.exe`)과 실행 중인 `D3RO Voice` 로 실제 `SendInput` 키 입력 E2E 를 수행해 4가지 실환경 결함을 잡고 검증했다: (1) `.bat` 래퍼(`cmd.exe` CUI)로 띄울 때 `uiohook` 이 인터랙티브 키 이벤트를 받지 못하던 문제를 `electron.exe` GUI 직접 실행으로 해결, (2) `_watchRevert` 가 새 문장에서 같은 오타(`ㅗ디ㅣㅐ`)를 다시 쳤을 때 되돌림으로 오인해 `typoIgnoredWords` 에 영구 등록하던 결함을 `prefixBefore`/`windowHandle`/낱자 차단으로 해결, (3) 한글 IME 상태에서 `ㅖㅇㄹ파일`(Shift+PDF + 파일) 입력 시 `PDF파일` 변환 추가, (4) `Ctrl+V` 클립보드 붙여넣기가 Windows `ClipboardSvcGroup`(`WM_CLIPBOARDUPDATE`)의 `OpenClipboard` 잠금과 충돌해 간헐적으로 누락되던 결함을 `SendInput(KEYEVENTF_UNICODE)` 직접 유니코드 타이핑(`apps/desktop/src/main/utils/win32-unicode-input.ts`)으로 해결. **2026-10-27 터미널·Vim·xterm.js 지원 확장 및 라이브 E2E 검증:** (5) Windows Terminal 등 모든 터미널·개발 표면에서 일반 철자/모델 교정만 막고 한영 자판 전환(`layoutOnly: true`)은 허용, (6) `uia_bridge.py` 가 터미널 스크롤백 상단 대신 `GetVisibleRanges()` 하단 뷰포트를 읽고 `ExpandToEnclosingUnit(waitTime=0)` 으로 500ms 지연을 제거, (7) `TerminalKeystrokeTracker` + `extractTerminalActiveContext` + `isForegroundKoreanIme` 로 다중 줄 Vim 버퍼(`-- INSERT --` 상단 줄 편집)·캔버스 터미널(`len=0`)·Vim 노멀 모드 교정 차단·명령줄 모드(`:ㅈㅂ`→`:wq`, `:ㅂ!`→`:q!`)·입력 모드 진입 키(`i/a/o/s`) 분리를 구현, (8) `Agent Switchboard` 등의 xterm.js `<textarea class="xterm-helper-textarea">` 가 Enter/Ctrl+C 전까지 `.value` 를 비우지 않아 `ㅗ디ㅣㅐ재깅 `→`hello재깅 ` 교정 시 400ms 마다 `'h'` 가 누적되던 문제를 `isXtermHelperControl` + `reconcileWithXtermValue` + `재깅`→`world` + 교정 성공 후 `_lastCheckedRegion` 보존 + 프로그램 키 `_lastKeyAt` 미갱신으로 해결, (9) 채팅창 Enter 전송 직후 툴바 문구(`"탭 추가 @ 기호"`)에 제안이 뜨고 `gemma4:e4b` 가 프롬프트 지시문(`"검색어입니다."`, `"키워드 몇 개로만 짧게 이어 쓰세요."`)을 되풀이하던 문제를 `clearedByEnter` 기준선 재설정 + `INSTRUCTION_ECHO_PATTERN` 확장으로 해결. | `apps/desktop/src/main/services/{TypoCorrectionService,TextInsertService,InputTelemetryService}.ts`, `apps/desktop/src/main/utils/{win32-unicode-input,win32-foreground}.ts`, `apps/desktop/sidecar/uia_bridge.py`, `packages/core/src/{araso-layout,typo-correction,terminal-prompt,suggestion-text}.ts` | `[x]` 2026-10-26 일반 앱 GUI E2E(`E2ETestBox.exe`, 8/8 시나리오 전수 통과, 91~509ms) + **2026-10-27 터미널·Vim GUI E2E(`neovide.exe` PID + `D3RO Voice` PID 90844, 6/6 시나리오 전수 통과):** Vim INSERT 모드 `dkssudgktpdy `→`안녕하세요 `(197ms), Vim 명령줄 `:ㅈㅂ`→`:wq`(215ms, `:` 보존), Vim 명령줄 `:ㅂ!`→`:q!`(90ms), 셸 프롬프트 `PS D:\workspace> 퍄ㅡ `→`vim `(106ms), 셸 프롬프트 `PS D:\workspace> ㅎ샤 채ㅜㄴㅅ `→`git const `(170ms), 캔버스 터미널(`UIA len=0`) `<Esc>idkssudgktpdy `→`안녕하세요 `(108ms). 단위 테스트: `packages/core` 3개 파일 82/82 통과(`typo-correction.test.ts` 44/44, `terminal-prompt.test.ts` 12/12, `suggestion-continuation.test.ts` 26/26), 데스크톱 `TypoCorrectionService.test.ts` 22/22 통과. |
|
||||
| GAP-INPUT-09 | Input intelligence | `[~]` **prefill 이어 쓰기·문서/대화 문맥(INPUT-21) 실앱 확인 (2026-10-03).** 실제 `gemma4:e4b` 프로브 15개 시나리오와 단위 테스트는 통과했지만, (a) 외부 앱 UIA 가 커서 앞 문서 전체를 주는지(케어렛 미상 앱은 tail 폴백), (b) 채팅 앱이 보내기 뒤 입력칸을 실제로 비우는 스냅샷을 내는지(카톡은 UIA 텍스트 길이 0 인 경우가 있었다 — GAP-INPUT-01), (c) 단어 중간 수락(`attach`)이 실제 삽입에서 공백 없이 붙는지는 GUI 로 확인하지 않았다. 후보 다양성: 마저 쓰기 모드는 prefill 분포가 뾰족해 채우기 후보가 1~2개에서 멈출 때가 많다. | `apps/desktop/src/main/services/{SuggestionService,InputTelemetryService,LocalLLMService,llm-prompts}.ts`, `packages/core/src/{chat-template,recent-writes,suggestion-text,writing-context}.ts`, `apps/desktop/tests/integration/suggestion-quality.ollama.test.ts` | `run-desktop.bat` 재시작 후: (1) 긴 메모장 문서 끝에서 앞부분의 날짜·이름을 이어 받는지, (2) 슬랙/디스코드 같은 Chromium 채팅에서 메시지를 보낸 뒤 다음 메시지 제안이 앞 메시지를 이어 받는지(로그 `제안 판단 입력` + 프롬프트 길이), (3) `내일 3시에 회의실` 같은 단어 중간에서 수락하면 `회의실에서…` 로 붙는지, (4) 지어낸 사실로 후보를 버린 로그(`제안 후보 버림 (unsupported-facts…)`)가 과하게 잦지 않은지. 모델 교체 시 `D3RO_SUGGESTION_PROBE=1 D3RO_SUGGESTION_PROBE_MODEL=<태그>` 로 같은 프로브를 다시 돌린다. **2026-10-03 19:00 "제안 창이 잘 안 뜸" 로그 분석**: 보류 1위 WindowsTerminal(Claude Code) `caret-unknown` 721회 — 입력 상자 아래 상태줄 때문에 화면 전체 기준으로 매번 "문서 중간 편집" 판정 → `SuggestionService._terminalContext` 가 입력 줄 연속성(늘거나 줄면 커서=끝)으로 판단. 2위 Chrome `not-typing` 122회 — 타이핑 중 UIA 포커스가 입력칸↔legacy 요소를 오가며 기준선을 다시 잡음 → 같은 창·클릭 없이 치는 중의 깜빡임이면 편집한 칸 유지(`input-telemetry-focus-flicker.test.ts`). 모든 앱에서 caret 오프셋을 못 얻는 것(caret=-1)과 Kitedesk/Candy/Paca 의 legacy(읽기 불가)는 별도 과제. 19:10 재시작 뒤 6분간 첫 후보 10회 생성(터미널 caret-unknown 721→4). **수락 키 전달 문제**: uiohook 은 키를 엿듣기만 해서 Ctrl+Alt+Enter 가 Claude Code 에도 전달돼 개행이 들어갔다 → 제안 창이 떠 있는 동안만 제안 단축키를 globalShortcut(noop)으로 잡아 OS 가 삼키게 하고 창이 사라지면 해제(`KeyBindingService.setSuggestionCaptureActive`, `suggestionCaptureAccelerators`). 실앱에서 수락 시 개행이 더는 안 들어가는지, 창이 없을 때 다른 앱의 Ctrl+Alt+Enter/↑↓ 가 정상인지 확인 필요. |
|
||||
| GAP-INPUT-11 | Input responsiveness | `[~]` **2026-10-30 사용자 보고: 모델 최초 로드/높은 CPU 부하에서 한글 타이핑 누락 (`안녕하세요` → `안세요`).** (1) **결정적 원인 규명 및 수정:** 한국어 두벌식 입력에서 받침 뒤 다음 음절 초성을 치는 순간(`"안ㄴ"`, `"안녕ㅎ"`, `"한ㄱ"` 등) `detectJamoNoise`가 커서 끝 초성을 낱자 잡음(`from: "안ㄴ", to: "안"`, `deleteCount: 2`)으로 오판하고, 모델이 아직 콜드(`warmModel() === null`, 모델 최초 로드 시점)일 때 `TypoCorrectionService.handleTypingContext`가 650ms 모델 디바운스를 건너뛰고 즉시 `replaceBeforeCaret(2, "안")`을 실행해 방금 완성된 `"안녕"`을 `"안"`으로 덮어써 `"안녕하세요"`가 `"안세요"`가 되거나 새 어절 첫 자음(`"오늘 ㅇ"`)이 백스페이스로 지워지던 버그를 수정했다(`packages/core/src/typo-correction.ts` 커서 끝 초성 보호 + `TypoCorrectionService.ts` 커서 직전 토큰 자동 삭제 차단). (2) 코드에서 오래된 UIA 문맥·삽입 큐 대기 후 재검증 누락·부분 SendInput 성공 뒤 삭제 재실행 위험을 확인하고 보호 장치를 추가했으며, 로컬 Ollama/Whisper 작업 수도 최대 4개로 제한했다. (3) `win32-foreground.ts`에서 프로세스 이미지 경로 캐시(최대 256 PID)와 `isForegroundKoreanIme` 캐시(400ms TTL, 타임아웃 30ms→8ms 단축)를 적용하고, `uia_bridge.py`에서 `_wake_chromium_accessibility`의 동기 `WM_GETOBJECT` 호출을 HWND별 60초 TTL로 캐시하며, `InputTelemetryService._sampleWhileTyping`이 키 입력 직후 350ms 이내에는 중복 폴링을 건너뛰도록 최적화했다. **추가 deterministic A/B:** 3개 서비스만 HEAD `f49acf0`로 대체하고 나머지 의존성·테스트는 현재 상태를 유지한 비교에서 HEAD 1/17, 수정본 17/17 통과. | `packages/core/src/typo-correction.ts`, `InputTelemetryService.ts`, `TypoCorrectionService.ts`, `TextInsertService.ts`, `utils/{win32-foreground,win32-input-activity,win32-unicode-input,inference-cpu-budget}.ts`, `sidecar/{uia_bridge,cpu_budget}.py`; `scripts/verification/typing-race-proof.mjs`, `packages/core/__tests__/typo-correction.test.ts` (53/53), `TypoCorrectionService.test.ts` (28/28) | `typing-fixture`와 별도 로컬 프로필의 `typing-runtime` 빌드 완료, 단위·경합 A/B 테스트 전수 통과(`packages/core` 566/566, `TypoCorrectionService.test.ts` 28/28, `typing-race-proof.mjs` 17/17). 남은 것은 외부 인터랙티브 세션에서 실제 GUI 연속 타이핑 수동 확인이다. |
|
||||
| GAP-INPUT-11 | Input responsiveness | `[~]` **2026-10-30..31 사용자 보고: 모델 최초 로드/높은 CPU 부하 및 터미널(`Agent Switchboard.exe` `xterm.js` 등) 환경에서 한글 타이핑 누락 (`안녕하세요` → `안세요`, 터미널 1글자씩 씹힘).** (1) **결정적 원인 규명 및 수정:** 한국어 두벌식 입력에서 받침 뒤 다음 음절 초성을 치는 순간(`"안ㄴ"`, `"안녕ㅎ"`, `"한ㄱ"` 등) `detectJamoNoise`가 커서 끝 초성을 낱자 잡음(`from: "안ㄴ", to: "안"`, `deleteCount: 2`)으로 오판하고, 모델이 아직 콜드(`warmModel() === null`, 모델 최초 로드 시점)일 때 `TypoCorrectionService.handleTypingContext`가 650ms 모델 디바운스를 건너뛰고 즉시 `replaceBeforeCaret(2, "안")`을 실행해 방금 완성된 `"안녕"`을 `"안"`으로 덮어써 `"안녕하세요"`가 `"안세요"`가 되거나 새 어절 첫 자음(`"오늘 ㅇ"`)이 백스페이스로 지워지던 버그를 수정했다(`packages/core/src/typo-correction.ts` 커서 끝 초성 보호 + `TypoCorrectionService.ts` 커서 직전 토큰 자동 삭제 차단). (2) 코드에서 오래된 UIA 문맥·삽입 큐 대기 후 재검증 누락·부분 SendInput 성공 뒤 삭제 재실행 위험을 확인하고 보호 장치를 추가했으며, 로컬 Ollama/Whisper 작업 수도 최대 4개로 제한했다. (3) **2026-10-31 터미널·`xterm.js` 1글자씩 씹힘(`03:04:11~03:04:48` 실로그 규명) 수정:** 터미널에서 `TextInsertService`가 키를 한 번도 보내지 않았는데도 한글이 1글자씩 씹히던 직접 원인이 ① `InputTelemetryService._handleKeyDown`에서 터미널일 때만 매 키다운마다 호출하던 크로스-프로세스 `isForegroundKoreanIme`(`SendMessageTimeoutW(WM_IME_CONTROL)`)와 ② 40ms 경계 스냅샷·800ms 폴링마다 `uia_bridge.py`가 `xterm-helper-textarea`에 대해 호출하던 `GetTopLevelControl()`·`TextPattern.GetSelection()`·`ExpandToEnclosingUnit(Character)`·`TextEditPattern.GetActiveComposition()`(Chromium 렌더러 스레드 최대 1,500ms 블로킹 및 `comp=True` 고착)이었음을 확인하고, 키다운 중 `WM_IME_CONTROL` 호출 제거(유휴 스냅샷 1회 동기화 `syncKoreanIme`), `uia_bridge.py` `xterm-helper-textarea` 고속 경로(`TextPattern` 생략) 및 `_WAKE_TTL_SECONDS` 86,400초 연장, 일반 한글 단어 공백 직후 40ms 스냅샷·680ms 중복 타이머·800ms 터미널 폴링 억제, 터미널 내 공백 전 완성형 한글 음절(`[가-힣]$`) 교정 억제를 적용했다. **추가 deterministic A/B:** 3개 서비스만 HEAD `f49acf0`로 대체하고 나머지 의존성·테스트는 현재 상태를 유지한 비교에서 HEAD 1/17, 수정본 17/17 통과. | `packages/core/src/{typo-correction,terminal-prompt}.ts`, `InputTelemetryService.ts`, `TypoCorrectionService.ts`, `TextInsertService.ts`, `utils/{win32-foreground,win32-input-activity,win32-unicode-input,inference-cpu-budget}.ts`, `sidecar/{uia_bridge,cpu_budget}.py`; `scripts/verification/typing-race-proof.mjs`, `packages/core/__tests__/{typo-correction,terminal-prompt}.test.ts` (66/66), `TypoCorrectionService.test.ts` (29/29) | `typing-fixture`와 별도 로컬 프로필의 `typing-runtime` 빌드 완료, 단위·경합 A/B 테스트 전수 통과(`packages/core` 66/66, `TypoCorrectionService.test.ts` 29/29, `typing-race-proof.mjs` 17/17). 남은 것은 외부 인터랙티브 세션에서 실제 GUI 연속 타이핑 수동 확인이다. |
|
||||
| GAP-INPUT-10 | Input intelligence | `[~]` **제안 창 오타 교정·반응성(INPUT-22) 실앱 확인 (2026-10-17) 및 2026-10-30 조합 백스페이스/초성 유실 수정.** 단위 테스트·실모델 프로브·팝업 렌더 스크린샷은 통과. (1) 이력 DB 접두에 반복되던 홀로 남은 `ㅇ` 및 글자 삼킴은 커서 끝 초성(`"안ㄴ"`, `"오늘 ㅇ"`)에 대한 `detectJamoNoise` 조기 개입이 원인이었음을 규명해 차단했다(GAP-INPUT-11 참조). (2) Chrome·Electron 계열에서 UIA `GetActiveComposition` 미지원으로 `snapshot.isComposing`이 항상 `false`가 되어 마지막 글자 조합 중 교정/제안 수락 시 Space 확정 없이 백스페이스가 나가 MS IME가 자모 단위로 지우던(`안ㄴ안녕…`) 문제를 해결하기 위해, `InputTelemetryService`에서 키스트로크 기반 한글 조합 상태(`_imeComposing`)를 추적해 `context.isComposing`에 반영하고, `SuggestionService.accept()`도 `/[가-힣]$/u.test(acceptPrefix)` 및 `insertMethod === 'keyboard'` 프로그램 키 계산을 정밀화했다. | `apps/desktop/src/main/services/{SuggestionService,TypoCorrectionService,TextInsertService,InputTelemetryService}.ts`, `apps/desktop/src/renderer/popups/suggestion-overlay/*`, `packages/core/src/typo-correction.ts` | 에이전트 창·카톡·크롬에서: (1) `안ㄴ뇽하세여.?` 치고 멈추면 `오타 고침` 줄과 함께 후보가 뜨는지, 수락하면 오타가 지워지고 `안녕하세요.? …` 로 바뀌는지, (2) 마지막 글자가 조합 중일 때 수락해도 글자가 남거나 더 지워지지 않는지, (3) 수락 → Space → 멈춤에서 다음 제안이 바로 뜨는지(`rate-limited` 로그 없어야 함), (4) 후보 12개가 다 차도 창이 저절로 닫히지 않는지(45초 TTL 전), (5) 낱자 없는 오타는 첫 후보 뒤 교정 줄이 늦게 붙는지 실앱 수동 확인. |
|
||||
|
||||
| GAP-SYNC-01 | Sync | Desktop↔mobile sync was one-way and lossy. (1) `pushAll` set the cursor to *now* before `pullAll` ran, so the first pull after sign-in fetched nothing — mobile-created data never reached the desktop except via Realtime while running (which never connected, GAP-SYNC-02). (2) `_inArray` used only the first meeting id, so memos/documents of every other meeting were never pushed. (3) No deletion propagation either way. (4) Pull had no `user_id` filter — team meetings of other users landed in the personal DB and a desktop re-push cleared `team_id`. (5) One global, local-clock cursor across accounts; no pagination (1,000-row cap). (6) Desktop writes did not move `history.revision`, so mobile's optimistic concurrency silently overwrote desktop edits. (7) One case-duplicate dictionary word failed the whole batch. (8) Memo tags, custom commands, templates, favorites and history titles were not synced at all; anonymous local-mode data was never uploaded after sign-in. | `apps/desktop/src/main/services/sync/*`, `CloudSyncService.ts`, `server/supabase/migrations/20260927000034_cross_device_sync_parity.sql` | `[x]` 2026-09-27: engine rewritten (outbox + per-user server-clock keyset cursors + tombstones + per-row isolation + dictionary adoption + natural-key memo tags + client-keyed template RPCs + local-mode import). Evidence: `apps/desktop/tests/main/sync/SyncEngine.test.ts` (20) + `apps/desktop/tests/integration/cross-device-sync.supabase.test.ts` (5, local Supabase stack); full desktop suite 1499/1500 (1 = known caption env timeout); SQL checks for revision bump, tombstones, account-delete cascade. |
|
||||
|
|
|
|||
|
|
@ -329,6 +329,31 @@ describe('terminal prompt extraction', () => {
|
|||
expect(tracker.vimMode).toBeNull()
|
||||
expect(tracker.currentPrefix()).toBe('햣')
|
||||
})
|
||||
|
||||
it('키다운마다 koreanIme 를 넘기지 않아도 유휴 스냅샷에서 syncKoreanIme(true) 로 미치환 영문 꼬리를 한글로 복원한다', () => {
|
||||
const tracker = new TerminalKeystrokeTracker()
|
||||
const hwnd = 9901
|
||||
expect(tracker.hasObservedImeForHwnd(hwnd)).toBe(false)
|
||||
|
||||
// 키다운 훅 도중에는 SendMessageTimeoutW(WM_IME_CONTROL) 를 호출하지 않으므로 koreanIme 가 생략된다.
|
||||
for (const vk of [0x50, 0x43, 0x20]) {
|
||||
tracker.onKeyDown({
|
||||
hwnd,
|
||||
windowTitle: 'Kitedesk',
|
||||
vk,
|
||||
shift: false,
|
||||
ctrl: false,
|
||||
alt: false,
|
||||
meta: false
|
||||
})
|
||||
}
|
||||
expect(tracker.currentPrefix()).toBe('pc ')
|
||||
|
||||
// 유휴 스냅샷 시점에 단 한 번 IME 상태를 동기화하면 미치환 영문 꼬리 'pc ' 가 'ㅔㅊ ' 로 복원된다.
|
||||
tracker.syncKoreanIme(true)
|
||||
expect(tracker.hasObservedImeForHwnd(hwnd)).toBe(true)
|
||||
expect(tracker.currentPrefix()).toBe('ㅔㅊ ')
|
||||
})
|
||||
})
|
||||
|
||||
describe('a visible suggestion survives a typing pause', () => {
|
||||
|
|
|
|||
|
|
@ -444,6 +444,7 @@ export class TerminalKeystrokeTracker {
|
|||
private _composingKeys = ''
|
||||
private _koreanIme = false
|
||||
private _imm32Supported = false
|
||||
private _imeObserved = false
|
||||
private _lastImeToggleAt = 0
|
||||
private _vimSession = false
|
||||
private _vimMode: TerminalVimMode = null
|
||||
|
|
@ -466,10 +467,32 @@ export class TerminalKeystrokeTracker {
|
|||
this._unreplacedStart = 0
|
||||
}
|
||||
|
||||
hasObservedImeForHwnd(hwnd: number | null): boolean {
|
||||
return hwnd !== null && this._hwnd === hwnd && this._imeObserved
|
||||
}
|
||||
|
||||
/**
|
||||
* 키다운 훅 도중(WM_KEYDOWN 처리 중)이 아니라 유휴 스냅샷 시점에 관측한 IME 상태를 반영한다.
|
||||
* 포커스 직후 첫 스냅샷에서 한글 IME 가 감지되면 아직 치환되지 않은 영문 키 꼬리를 두벌식 한글로 복원한다.
|
||||
*/
|
||||
syncKoreanIme(koreanIme: boolean | null | undefined): void {
|
||||
this._imeObserved = true
|
||||
if (typeof koreanIme !== 'boolean') return
|
||||
if (koreanIme) {
|
||||
this._imm32Supported = true
|
||||
this._koreanIme = true
|
||||
this._convertUnreplacedAsciiTailToHangul()
|
||||
} else if (this._imm32Supported) {
|
||||
this._flushComposing()
|
||||
this._koreanIme = false
|
||||
}
|
||||
}
|
||||
|
||||
onPointerOrFocusChange(hwnd?: number | null): void {
|
||||
if (hwnd !== undefined && hwnd !== this._hwnd) {
|
||||
this._hwnd = hwnd
|
||||
this._imm32Supported = false
|
||||
this._imeObserved = false
|
||||
this._vimSession = false
|
||||
this._vimMode = null
|
||||
this._shellPromptScreen = false
|
||||
|
|
@ -484,6 +507,7 @@ export class TerminalKeystrokeTracker {
|
|||
if (input.hwnd !== null && input.hwnd !== this._hwnd) {
|
||||
this._hwnd = input.hwnd
|
||||
this._imm32Supported = false
|
||||
this._imeObserved = false
|
||||
this._vimSession = false
|
||||
this._vimMode = null
|
||||
this._shellPromptScreen = false
|
||||
|
|
@ -511,6 +535,7 @@ export class TerminalKeystrokeTracker {
|
|||
this._afterEscape = false
|
||||
}
|
||||
this._koreanIme = !this._koreanIme
|
||||
this._imeObserved = true
|
||||
this._lastImeToggleAt = now
|
||||
return
|
||||
}
|
||||
|
|
@ -519,6 +544,7 @@ export class TerminalKeystrokeTracker {
|
|||
// ImmGetDefaultIMEWnd(IMC_GETCONVERSIONMODE)가 한글 상태에서도 항상 false(0)를 돌려준다.
|
||||
// 따라서 해당 창에서 한 번이라도 true 가 관측된 경우(_imm32Supported)에만 false 로의 하향 동기화를 허용한다.
|
||||
if (typeof input.koreanIme === 'boolean') {
|
||||
this._imeObserved = true
|
||||
if (input.koreanIme) {
|
||||
this._imm32Supported = true
|
||||
}
|
||||
|
|
@ -792,6 +818,14 @@ export class TerminalKeystrokeTracker {
|
|||
resolved = resolved.trimEnd() + ' '
|
||||
}
|
||||
|
||||
if (/[가-힣ㄱ-ㆎ]\s*$/u.test(resolved)) {
|
||||
this._koreanIme = true
|
||||
this._imeObserved = true
|
||||
this._convertUnreplacedAsciiTailToHangul()
|
||||
} else if (/[A-Za-z]\s*$/u.test(resolved)) {
|
||||
this._imeObserved = true
|
||||
}
|
||||
|
||||
this._lastScreenPrefix = resolved
|
||||
return {
|
||||
prefix: resolved,
|
||||
|
|
@ -818,6 +852,7 @@ export class TerminalKeystrokeTracker {
|
|||
if (hwnd !== null && this._hwnd !== null && hwnd !== this._hwnd) {
|
||||
this._hwnd = hwnd
|
||||
this._imm32Supported = false
|
||||
this._imeObserved = false
|
||||
this._vimSession = false
|
||||
this._vimMode = null
|
||||
this._shellPromptScreen = false
|
||||
|
|
@ -829,20 +864,16 @@ export class TerminalKeystrokeTracker {
|
|||
/[가-힣ㄱ-ㆎ]\s*$/u.test(raw) && raw.trimEnd() !== this._lastXtermValue.trimEnd()
|
||||
if (hasNewHangul) {
|
||||
this._koreanIme = true
|
||||
const unreplacedTail = this._committed.slice(this._unreplacedStart)
|
||||
if (/[A-Za-z]/u.test(unreplacedTail) && !/[가-힣ㄱ-ㆎ]/u.test(unreplacedTail)) {
|
||||
const convertedTail = unreplacedTail.replace(/[A-Za-z]+/gu, (word) => {
|
||||
const norm = word.replace(/[A-Z]/gu, (c) => (/^[QWERTPO]$/u.test(c) ? c : c.toLowerCase()))
|
||||
return composeHangul2Set(norm)
|
||||
})
|
||||
this._committed = this._committed.slice(0, this._unreplacedStart) + convertedTail
|
||||
} else if (
|
||||
this._unreplacedStart === 0 &&
|
||||
this._lastXtermValue === '' &&
|
||||
this._committed.length === 0 &&
|
||||
this._composingKeys.length === 0
|
||||
) {
|
||||
this._committed = raw
|
||||
this._imeObserved = true
|
||||
if (!this._convertUnreplacedAsciiTailToHangul()) {
|
||||
if (
|
||||
this._unreplacedStart === 0 &&
|
||||
this._lastXtermValue === '' &&
|
||||
this._committed.length === 0 &&
|
||||
this._composingKeys.length === 0
|
||||
) {
|
||||
this._committed = raw
|
||||
}
|
||||
}
|
||||
}
|
||||
this._lastXtermValue = raw
|
||||
|
|
@ -850,6 +881,19 @@ export class TerminalKeystrokeTracker {
|
|||
return this.getSnapshot(hwnd, windowTitle)
|
||||
}
|
||||
|
||||
private _convertUnreplacedAsciiTailToHangul(): boolean {
|
||||
const unreplacedTail = this._committed.slice(this._unreplacedStart)
|
||||
if (/[A-Za-z]/u.test(unreplacedTail) && !/[가-힣ㄱ-ㆎ]/u.test(unreplacedTail)) {
|
||||
const convertedTail = unreplacedTail.replace(/[A-Za-z]+/gu, (word) => {
|
||||
const norm = word.replace(/[A-Z]/gu, (c) => (/^[QWERTPO]$/u.test(c) ? c : c.toLowerCase()))
|
||||
return composeHangul2Set(norm)
|
||||
})
|
||||
this._committed = this._committed.slice(0, this._unreplacedStart) + convertedTail
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private _handleVimNormalChar(ch: string): void {
|
||||
if (this._pendingVimOperator === 'c') {
|
||||
if (ch === 'i' || ch === 'a' || ch === 'f' || ch === 'F' || ch === 't' || ch === 'T') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue