Skip to content

fix: route idle IME control keys to the seat and draw the composing bar - #61

Merged
anderson-oki merged 3 commits into
mainfrom
agent/product-engineer/23c0aebbfd58
Sep 29, 2026
Merged

anderson-oki merged 3 commits into
mainfrom
agent/product-engineer/23c0aebbfd58

Conversation

@anderson-oki

Copy link
Copy Markdown
Collaborator

What

Fixes the two verified in-stream IME defects for NEC-37.

WP1 — idle control keys reach the seat. shouldInterpretAsText checked for an inputmethod input source before inspecting the keystroke's characters, so with a CJK source merely selected and nothing composing, Backspace, Return, Escape, Tab, arrows and Space were claimed by text-input routing; interpretKeyEvents yielded nothing and the seat never saw them. A new pure static isIdleSeatKey(_:) classifies C0 controls, DEL, the Unicode private-use range and space and returns false for them ahead of the inputmethod branch. With marked text active the behaviour is unchanged (everything stays IME-side), as are the Command/Control rejection and Option/dead-key paths. Punctuation stays IME-routed while idle; space is deliberately forwarded because it is gameplay-critical.

WP2 — composing bar drawn in-stream. NativeNVSTCompositionBarView is a non-hit-testing AppKit subview of the owning NativeStreamView that draws the marked string with an underline and caret over the video. It is refreshed on setMarkedText and hidden on insertText, unmarkText, cancelOperation, teardown (releasePressedInputs) and window close. The prefix-offset computation is extracted into the pure static compositionPrefixWidth(_:upTo:font:), shared by the bar's caret, characterIndex(for:) and firstRect, which now returns a rect at the drawn bar's origin so the IME candidate panel docks above the visible composition.

Both stream window hosts use the single owning view, so the bar and routing land once for windowed and PiP modes.

Files

  • OPN/Stream/NativeStreamViewComposition.swift (new)
  • OPN/Stream/NativeStreamView.swift
  • OPN/Stream/NativeStreamViewInput.swift
  • OPN/Stream/NativeStreamViewRenderer.swift
  • Tests/Stream/NativeNVSTInputParityTests.swift

Verification

  • swift build --scratch-path .build/shared — success, no new warnings.
  • swift test --scratch-path .build/shared — full suite passed (2529 tests, 0 failures).
  • swift package --scratch-path .build/lint plugin --allow-writing-to-package-directory swiftlint lint --strict --baseline .swiftlint-baseline.json App GFN Model OPN View ViewModel Tests — 0 violations in 979 files; no new baseline entries.
  • xcodebuild -project OpenNOW.xcodeproj -scheme OpenNOW -configuration Debug -destination 'platform=macOS' build CODE_SIGNING_ALLOWED=NO — BUILD SUCCEEDED, 0 warnings.
  • New tests: shouldInterpretAsText idle-inputmethod matrix, isIdleSeatKey boundaries, and firstRect tracking the bar origin for start/mid/end ranges.

Note: xcodebuild test on this host failed one pre-existing, unrelated recording-startup test (StreamRecordingStartupTests.swift:47) and had headless-runner restarts; the same suite passes under SwiftPM. No live in-game capture was possible in this environment, so the visual/IME acceptance items need a manual pass.

Open items

  • Manual visual pass against the attached target screenshot, including PiP, is still required (no game session available here).
  • Follow-ups from the issue (text-input mode toggle, JIS/ANSI/ISO key-table audit) remain out of scope.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bb1675b1-6c87-4c38-ad4a-dc6ff337ce90


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@anderson-oki
anderson-oki merged commit 2eac7f8 into main Sep 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant