[PR #2176] [MERGED] Key binds: a key bound to several mappings drives all of them #4074

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2176
Author: @kacpherek
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/2161-shared-key-bindings


📝 Commits (2)

  • 7c16e83 Key binds: a key bound to several mappings drives all of them
  • 545370b Key binds: press a shared default key once

📊 Changes

2 files changed (+90 additions, -38 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+26 -19)
📝 crates/horizon-client/src/keybinds.rs (+64 -19)

📄 Description

What and why

A key bound to two mappings only triggered one of them. Binding W to both "Walk Forwards" and "Sprint", as many players do, made W walk but never sprint.

Horizon turns a physical key into the default key of the mapping it is bound to (KeyBinds::translate), and that took only the first mapping in list order. Vanilla drives every mapping bound to the key: KeyMapping.set and KeyMapping.click go through forAllKeyMappings, which presses all of them.

Now translate_all / translate_mouse_all return the default key of every mapping bound to the input, in list order, and the key and mouse handlers press and release each of them. translate / translate_mouse keep returning the first one, so the other callers and the existing tests are unchanged. A key with no binding whose default meaning moved elsewhere still does nothing.

Fixes #2161.

Vanilla reference

KeyMapping.set, KeyMapping.click and forAllKeyMappings: a key presses every mapping bound to it.

Self-check

cargo check -p horizon-client (and --tests) passes.


🔄 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/2176 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/2161-shared-key-bindings` --- ### 📝 Commits (2) - [`7c16e83`](https://github.com/horizon-rust/horizon/commit/7c16e83fdf200aa6eedb26e1dc6c0625712e7428) Key binds: a key bound to several mappings drives all of them - [`545370b`](https://github.com/horizon-rust/horizon/commit/545370b02370e6eab59fe6640d529f7a15379315) Key binds: press a shared default key once ### 📊 Changes **2 files changed** (+90 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+26 -19) 📝 `crates/horizon-client/src/keybinds.rs` (+64 -19) </details> ### 📄 Description ## What and why A key bound to two mappings only triggered one of them. Binding W to both "Walk Forwards" and "Sprint", as many players do, made W walk but never sprint. Horizon turns a physical key into the default key of the mapping it is bound to (`KeyBinds::translate`), and that took only the first mapping in list order. Vanilla drives every mapping bound to the key: `KeyMapping.set` and `KeyMapping.click` go through `forAllKeyMappings`, which presses all of them. Now `translate_all` / `translate_mouse_all` return the default key of every mapping bound to the input, in list order, and the key and mouse handlers press and release each of them. `translate` / `translate_mouse` keep returning the first one, so the other callers and the existing tests are unchanged. A key with no binding whose default meaning moved elsewhere still does nothing. Fixes #2161. ## Vanilla reference `KeyMapping.set`, `KeyMapping.click` and `forAllKeyMappings`: a key presses every mapping bound to it. ## Self-check `cargo check -p horizon-client` (and `--tests`) passes. --- <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:29 +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#4074
No description provided.