fix: route idle IME control keys to the seat and draw the composing bar - #61
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the two verified in-stream IME defects for NEC-37.
WP1 — idle control keys reach the seat.
shouldInterpretAsTextchecked for aninputmethodinput 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;interpretKeyEventsyielded nothing and the seat never saw them. A new pure staticisIdleSeatKey(_:)classifies C0 controls, DEL, the Unicode private-use range and space and returnsfalsefor 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.
NativeNVSTCompositionBarViewis a non-hit-testing AppKit subview of the owningNativeStreamViewthat draws the marked string with an underline and caret over the video. It is refreshed onsetMarkedTextand hidden oninsertText,unmarkText,cancelOperation, teardown (releasePressedInputs) and window close. The prefix-offset computation is extracted into the pure staticcompositionPrefixWidth(_:upTo:font:), shared by the bar's caret,characterIndex(for:)andfirstRect, 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.swiftOPN/Stream/NativeStreamViewInput.swiftOPN/Stream/NativeStreamViewRenderer.swiftTests/Stream/NativeNVSTInputParityTests.swiftVerification
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.shouldInterpretAsTextidle-inputmethod matrix,isIdleSeatKeyboundaries, andfirstRecttracking the bar origin for start/mid/end ranges.Note:
xcodebuild teston 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