[PR #5612] [MERGED] Fix heal_hold_latches wiping logical sneak key when rebound away from Shift #6387

Closed
opened 2026-11-03 06:19:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5612
Author: @Lostpold88
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/rebound-sneak-heal-latches


📝 Commits (2)

  • c85748d Fix heal_hold_latches wiping logical sneak key when rebound away from Shift
  • e9834be Update heal_hold_latches doc comment to reflect physical_keys clearing

📊 Changes

1 file changed (+9 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+9 -8)

📄 Description

> 🤖 Opened by Lostpold88's AI agent (Gemini 3.8 Flash), not by Lostpold88 personally.

Fixes #5608

Cause

In PR #5208 (#5206), heal_hold_latches was added to heal stuck modifiers across focus loss.
It checked if !shift and called self.keys.remove(&key) for KeyCode::ShiftLeft.

However, self.keys holds the logical gameplay keys, and sync_toggle(0) uses KeyCode::ShiftLeft to represent active sneak regardless of whether sneak is physically bound to Shift, Control, C, or a gamepad button.

Calling self.keys.remove(&key) whenever physical Shift is up unconditionally cleared active sneak every frame for players with rebound sneak controls. Removing that line fixes the issue while preserving the intended physical modifier release in self.physical_keys.

pr_ready (tools/pr_ready.py --quick on PC, against origin/main at c9d8e3efa, 6 min 50 s)

Check Result
Scope ✅ 1 files, +0 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 510 passed (1 min 6 s)
rustfmt ✅ (9 s)
clippy ✅ (2 min 42 s)
tests: horizon-client ✅ 1573 passed (2 min 37 s)
doc tests ✅ 0 passed (11 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Antigravity


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5612 **Author:** [@Lostpold88](https://github.com/Lostpold88) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/rebound-sneak-heal-latches` --- ### 📝 Commits (2) - [`c85748d`](https://github.com/horizon-rust/horizon/commit/c85748d294046b875840cd0538a7965d77c5cd2e) Fix heal_hold_latches wiping logical sneak key when rebound away from Shift - [`e9834be`](https://github.com/horizon-rust/horizon/commit/e9834be29340ebd81a63375111b6bec0aa786324) Update heal_hold_latches doc comment to reflect physical_keys clearing ### 📊 Changes **1 file changed** (+9 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+9 -8) </details> ### 📄 Description > 🤖 Opened by Lostpold88's AI agent (Gemini 3.8 Flash), not by Lostpold88 personally. Fixes #5608 ### Cause In PR #5208 (#5206), `heal_hold_latches` was added to heal stuck modifiers across focus loss. It checked `if !shift` and called `self.keys.remove(&key)` for `KeyCode::ShiftLeft`. However, `self.keys` holds the logical gameplay keys, and `sync_toggle(0)` uses `KeyCode::ShiftLeft` to represent active sneak regardless of whether sneak is physically bound to Shift, Control, C, or a gamepad button. Calling `self.keys.remove(&key)` whenever physical `Shift` is up unconditionally cleared active sneak every frame for players with rebound sneak controls. Removing that line fixes the issue while preserving the intended physical modifier release in `self.physical_keys`. **pr_ready** (`tools/pr_ready.py --quick` on PC, against origin/main at c9d8e3efa, 6 min 50 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +0 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 510 passed (1 min 6 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 min 42 s) | | tests: horizon-client | ✅ 1573 passed (2 min 37 s) | | doc tests | ✅ 0 passed (11 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Antigravity](https://deepmind.google) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:19:49 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6387
No description provided.