[GH-ISSUE #5608] heal_hold_latches clears active sneak key when sneak is rebound away from Shift #1748

Closed
opened 2026-11-02 15:49:22 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Lostpold88 on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5608

Originally assigned to: @Lostpold88 on GitHub.

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

Description

In PR #5208 (#5206), heal_hold_latches was added to Game's frame loop to clear stuck modifier latches on focus loss. However, it unconditionally executes:
\\
ust
if !shift {
for key in [KeyCode::ShiftLeft, KeyCode::ShiftRight] {
self.physical_keys.remove(&key);
self.keys.remove(&key);
}
}
\\

Because self.keys tracks the logical gameplay keys, and sync_toggle(0) uses KeyCode::ShiftLeft to represent the active sneak state regardless of which physical key is mapped to sneak, this unconditionally strips KeyCode::ShiftLeft from self.keys on every frame whenever the player is not physically holding Shift.

As a result, any player who rebinds sneak away from Shift (for example, to Left Control or C, or when sneaking with a controller/gamepad) cannot sneak: self.keys.contains(&KeyCode::ShiftLeft) is cleared every frame.

Reproduction

  1. Set \key_key.sneak:key.keyboard.left.control\ (or rebind sneak to Control in Options -> Controls -> Key Binds).
  2. Enter a world and press Left Control.
  3. The player fails to sneak because \KeyCode::ShiftLeft\ is removed from \self.keys\ every frame by \heal_hold_latches.
Originally created by @Lostpold88 on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5608 Originally assigned to: @Lostpold88 on GitHub. > 🤖 Filed by Lostpold88's AI agent (Gemini 3.8 Flash), not by Lostpold88 personally. ### Description In PR #5208 (#5206), heal_hold_latches was added to Game's frame loop to clear stuck modifier latches on focus loss. However, it unconditionally executes: \\\ ust if !shift { for key in [KeyCode::ShiftLeft, KeyCode::ShiftRight] { self.physical_keys.remove(&key); self.keys.remove(&key); } } \\\ Because self.keys tracks the logical gameplay keys, and sync_toggle(0) uses KeyCode::ShiftLeft to represent the active sneak state regardless of which physical key is mapped to sneak, this unconditionally strips KeyCode::ShiftLeft from self.keys on every frame whenever the player is not physically holding Shift. As a result, any player who rebinds sneak away from Shift (for example, to Left Control or C, or when sneaking with a controller/gamepad) cannot sneak: self.keys.contains(&KeyCode::ShiftLeft) is cleared every frame. ### Reproduction 1. Set \key_key.sneak:key.keyboard.left.control\ (or rebind sneak to Control in Options -> Controls -> Key Binds). 2. Enter a world and press Left Control. 3. The player fails to sneak because \KeyCode::ShiftLeft\ is removed from \self.keys\ every frame by \heal_hold_latches\.
Author
Owner

@Lostpold88 commented on GitHub (Nov 1, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6551249583 --> @Lostpold88 commented on GitHub (Nov 1, 2026): 🤖 Agent: /claim
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#1748
No description provided.