feat(input,voice): instant first-word-after-focus PC layout fix and speech disfluency post-processing (INPUT-04, INPUT-19, AI-03, AI-05)
This commit is contained in:
parent
dbed97c348
commit
7a86afa7b0
22 changed files with 359 additions and 39 deletions
|
|
@ -225,6 +225,9 @@ class InputTelemetryService extends EventEmitter {
|
|||
private _rebaseFocusText = false
|
||||
/** 포커스 깜빡임 뒤 돌아온 칸 — 키보드로 친 채 돌아왔으므로 이미 편집한 칸으로 본다 */
|
||||
private _typedIntoFocus = false
|
||||
/** 현재 포커스/클릭 이후 실제로 글자 키를 쳤는가 (첫 스냅샷 전 빠른 입력 보존) */
|
||||
private _typedInCurrentFocus = false
|
||||
private _lastTypedHwnd: number | null = null
|
||||
/** 직전 스냅샷이 편집 가능한 칸이었는가 / 어느 창이었는가 (포커스 깜빡임 판정) */
|
||||
private _prevSnapshotEditable = false
|
||||
private _lastFocusHwnd: number | null = null
|
||||
|
|
@ -553,7 +556,13 @@ class InputTelemetryService extends EventEmitter {
|
|||
|
||||
this._lastKeyAt = Date.now()
|
||||
this._lastKeyClass = keyClass
|
||||
if (TYPING_KEY_CLASSES.has(keyClass)) this._lastTypedAt = this._lastKeyAt
|
||||
if (TYPING_KEY_CLASSES.has(keyClass)) {
|
||||
this._lastTypedAt = this._lastKeyAt
|
||||
this._typedInCurrentFocus = true
|
||||
this._lastTypedHwnd = this._foreground.hwnd
|
||||
} else if (keyClass === 'shortcut') {
|
||||
this._typedInCurrentFocus = false
|
||||
}
|
||||
// 진단: 키 값이 아니라 종류·수정자만 남긴다 (typed 판정이 왜 틀리는지 로그로 보이게)
|
||||
this._lastKeyDiag = `${keyClass}${vk === null ? `?${event.keycode}` : ''}${this._modifiers.ctrl ? '+C' : ''}${this._modifiers.alt ? '+A' : ''}${this._modifiers.meta ? '+M' : ''}`
|
||||
|
||||
|
|
@ -605,6 +614,7 @@ class InputTelemetryService extends EventEmitter {
|
|||
this._lastClickPos = position
|
||||
// 클릭은 다른 칸으로 옮겨 갔을 수 있다 — 다음 스냅샷의 텍스트를 새 기준으로 삼는다.
|
||||
this._rebaseFocusText = true
|
||||
this._typedInCurrentFocus = false
|
||||
this._terminalTracker.onPointerOrFocusChange(this._foreground.hwnd)
|
||||
}
|
||||
|
||||
|
|
@ -656,7 +666,10 @@ class InputTelemetryService extends EventEmitter {
|
|||
|
||||
if (isKeyboard) this._lastActiveTickAt = now
|
||||
this._lastEventAt = now
|
||||
this._sampleForeground(now, isKeyboard && gap >= 250)
|
||||
this._sampleForeground(
|
||||
now,
|
||||
isKeyboard && (gap >= 250 || this._rebaseFocusText || this._lastKeyClass === 'shortcut')
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -684,6 +697,9 @@ class InputTelemetryService extends EventEmitter {
|
|||
|
||||
const info = getForegroundWindowInfo()
|
||||
if (info) {
|
||||
if (info.hwnd !== this._foreground.hwnd) {
|
||||
this._typedInCurrentFocus = false
|
||||
}
|
||||
this._foreground = {
|
||||
appName: info.appName || null,
|
||||
windowTitle: info.title || null,
|
||||
|
|
@ -883,19 +899,27 @@ class InputTelemetryService extends EventEmitter {
|
|||
// 방금 친 글이 "들어올 때부터 있던 글" 이 되어 제안이 영영 안 뜬다. 클릭 없이 키보드로 치다가
|
||||
// 읽을 수 없는 요소를 거쳐 같은 창의 입력칸으로 돌아온 것이면 이미 편집한 칸으로 본다.
|
||||
const now = Date.now()
|
||||
this._typedIntoFocus =
|
||||
!this._rebaseFocusText &&
|
||||
!clearedByEnter &&
|
||||
const typedAfterFocus =
|
||||
this._typedInCurrentFocus &&
|
||||
this._foreground.hwnd !== null &&
|
||||
this._foreground.hwnd === this._lastFocusHwnd &&
|
||||
!this._prevSnapshotEditable &&
|
||||
this._lastTypedAt > this._lastClickAt &&
|
||||
this._foreground.hwnd === this._lastTypedHwnd &&
|
||||
this._lastTypedAt >= this._lastClickAt &&
|
||||
now - this._lastTypedAt <= SUGGESTION_DEFAULTS.recentTypingWindowMs
|
||||
this._typedIntoFocus =
|
||||
!clearedByEnter &&
|
||||
(typedAfterFocus ||
|
||||
(!this._rebaseFocusText &&
|
||||
this._foreground.hwnd !== null &&
|
||||
this._foreground.hwnd === this._lastFocusHwnd &&
|
||||
!this._prevSnapshotEditable &&
|
||||
this._lastTypedAt > this._lastClickAt &&
|
||||
now - this._lastTypedAt <= SUGGESTION_DEFAULTS.recentTypingWindowMs))
|
||||
this._lastFocusKey = focusKey
|
||||
this._textAtFocus = textForFocus
|
||||
this._rebaseFocusText = false
|
||||
if (clearedByEnter) {
|
||||
this._lastTypedAt = 0
|
||||
this._typedInCurrentFocus = false
|
||||
context.typedRecently = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue