[PR #2207] [CLOSED] Key binds: a key bound to several mappings triggers all of them #4105

Closed
opened 2026-11-03 04:14:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2207
Author: @Joansitoh
Created: 10/26/2026
Status: ❌ Closed

Base: main ← Head: fix/shared-key-binds


📝 Commits (2)

  • b4a472d Key binds: a key bound to several mappings triggers all of them
  • ccf3a8c Key binds: mappings sharing a default key act once

📊 Changes

3 files changed (+94 additions, -58 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+23 -18)
📝 crates/horizon-client/src/game/control.rs (+2 -1)
📝 crates/horizon-client/src/keybinds.rs (+69 -39)

📄 Description

🤖 Opened by Joansitoh's AI agent (Claude Code), not by Joansitoh.

What and why

Fixes #2161. With Walk Forward and Sprint both bound to W, only Walk Forward worked. KeyBinds::translate (and translate_mouse) turned a physical key into the default key of the first mapping bound to it, so every other mapping on that key was dropped. Options already marks such a conflict in yellow without preventing it.

How

  • keybinds.rs: translate and translate_mouse return every mapping bound to the key (empty = the key is inert, as before). mapping_for is replaced by mappings_for.
  • game.rs: the keyboard and mouse handlers dispatch each mapping.
  • game/control.rs: the horizon-ctl key path keeps using the first mapping (marked ponytail:).
  • Test: rebinding_translates_to_defaults now covers W bound to Walk Forward and Sprint.

Double-tap W for sprinting is a separate path (sprintTriggerTime) and is untouched.

Vanilla reference

net.minecraft.client.KeyMapping: MAP is Map<InputConstants.Key, List<KeyMapping>>, and set / click act on every mapping of the key (decompiled 26.3, KeyMapping.java:21). No harness: the vanilla behaviour here is input routing, covered by the unit test.

Self-check

pr_ready (tools/pr_ready.py --quick, Windows, against origin/main b78daab11)

Check Result
rustfmt ✅
Public tree ✅
clippy ❌ manual_range_contains in horizon-world/.../aquifer/noise_based.rs:450, a file this PR does not touch (newer local toolchain); no warnings in the touched files
tests: horizon-client ❌ 1151 passed, 2 failed: save::session_lock_is_exclusive (Windows file lock) and crash::stacks_start_at_the_panicking_frame; not compared against main
keybinds tests ✅ 3/3

Tested by hand: Key Binds screen shows Sprint and Walk Forward both on W with the conflict mark (screenshot to be attached).

🤖 Generated with Claude Code


🔄 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/2207 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 10/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/shared-key-binds` --- ### 📝 Commits (2) - [`b4a472d`](https://github.com/horizon-rust/horizon/commit/b4a472da08d81f5217c1a7d4ba6a667a9591e77b) Key binds: a key bound to several mappings triggers all of them - [`ccf3a8c`](https://github.com/horizon-rust/horizon/commit/ccf3a8cd2da7cbbd80224c92254ed01998b83f92) Key binds: mappings sharing a default key act once ### 📊 Changes **3 files changed** (+94 additions, -58 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+23 -18) 📝 `crates/horizon-client/src/game/control.rs` (+2 -1) 📝 `crates/horizon-client/src/keybinds.rs` (+69 -39) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code), not by Joansitoh. ## What and why Fixes #2161. With Walk Forward and Sprint both bound to W, only Walk Forward worked. `KeyBinds::translate` (and `translate_mouse`) turned a physical key into the default key of the **first** mapping bound to it, so every other mapping on that key was dropped. Options already marks such a conflict in yellow without preventing it. ## How - `keybinds.rs`: `translate` and `translate_mouse` return every mapping bound to the key (empty = the key is inert, as before). `mapping_for` is replaced by `mappings_for`. - `game.rs`: the keyboard and mouse handlers dispatch each mapping. - `game/control.rs`: the `horizon-ctl` key path keeps using the first mapping (marked `ponytail:`). - Test: `rebinding_translates_to_defaults` now covers W bound to Walk Forward and Sprint. Double-tap W for sprinting is a separate path (`sprintTriggerTime`) and is untouched. ## Vanilla reference `net.minecraft.client.KeyMapping`: `MAP` is `Map<InputConstants.Key, List<KeyMapping>>`, and `set` / `click` act on every mapping of the key (decompiled 26.3, `KeyMapping.java:21`). No harness: the vanilla behaviour here is input routing, covered by the unit test. ## Self-check **pr_ready** (`tools/pr_ready.py --quick`, Windows, against origin/main b78daab11) | Check | Result | | --- | --- | | rustfmt | ✅ | | Public tree | ✅ | | clippy | ❌ `manual_range_contains` in `horizon-world/.../aquifer/noise_based.rs:450`, a file this PR does not touch (newer local toolchain); no warnings in the touched files | | tests: horizon-client | ❌ 1151 passed, 2 failed: `save::session_lock_is_exclusive` (Windows file lock) and `crash::stacks_start_at_the_panicking_frame`; not compared against main | | keybinds tests | ✅ 3/3 | Tested by hand: Key Binds screen shows Sprint and Walk Forward both on W with the conflict mark (screenshot to be attached). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:14:44 +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#4105
No description provided.