Repository navigation
fix(nsgotest): release a key held by code on blur - #2360
Merged
Merged
Conversation
BlurWindow sent a held key up with the map's identity in Text and no KeyCode, so a key pressed with KeyCodeDown stayed down: KeyCodesDown never emptied and OnKeyUp heard the code where the name belongs. Dispatch the name and code the normal release uses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
houko
approved these changes
Nov 25, 2026
houko
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed against origin/main and issue #2248. BlurWindow now dispatches the held key's logical name and physical code, and the regression test verifies both key sets and OnKeyUp. Targeted go tool nsgo test ./nsgotest -run 'TestBlurWindowReleasesKeysHeldByCode$' -count=1 passed. All GitHub checks are green. Approving.
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.
Summary
nsgotest'sBlurWindowreleases every held key, as the desktops and the web do on focus loss, but it sent the key up with the held key's map identity inTextand noKeyCode. The identity is the physical code for a key pressed withKeyCodeDown, so the release carriedText: "KeyW"instead of the key name, and a game binding actions to physical positions kept them held:core.KeyCodesDownnever emptied andOnKeyUpnever heard its position come up.Dispatch the name and code the normal release path uses.
Fixes #2248.
Targets
core,base,ui,tsx, thensgotool)Screenshots
None; nothing visible changes.
Verification
New test
TestBlurWindowReleasesKeysHeldByCodeholdsKeyWwithKeyCodeDown, blurs the window and checks thatcore.KeyCodesDownandcore.KeysDownare empty and thatOnKeyUpheardKeyEvent{Key: "w", Code: "KeyW"}. Onmainit fails withafter BlurWindow: "[KeyW] [w]"; with the change it passes.A key held by name still comes up by name, which the existing
TestMouseDownUpHeldButtonsAndBlurWindowcovers together with the buttons.go tool nsgo test ./nsgotest -count=1: 242 passed, 0 failed, 1 skipped.go run ./tools/changelog checkpasses with the new fragment.go tool nsgo checkgo tool nsgo testgo tool nsgo test -target <target>on the targets aboveChecklist
fix(linux): keep the caret after a paste; a squash merge uses it as the commit subject.changelog.d/fragment, not inCHANGELOG.md. The documented behaviour was already right; the fragment ischangelog.d/blur-window-releases-coded-keys.md.🤖 Generated with Claude Code