[PR #6309] [MERGED] Type keyless characters (Windows Alt codes) into the focused text field #6786

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

📋 Pull Request Information

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

Base: main ← Head: fix/alt-codes-text


📝 Commits (1)

  • 76b26c9 Type the characters that come with no key (Windows Alt codes) into the focused text field

📊 Changes

1 file changed (+17 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+17 -0)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally.

Fixes #5844

What was wrong

An Alt code (Alt held, digits on the numeric keypad) makes Windows send a WM_CHAR with the composed character once Alt is released, with no key of its own. winit delivers it as a KeyboardInput with PhysicalKey::Unidentified and the character in text. Horizon's key handlers (chat_key, the other screens', the inventory search...) all begin with let PhysicalKey::Code(key) = event.physical_key else { return }, so the character was dropped. Vanilla's charTyped callback types it in the focused field.

What changes

window_event (game.rs): a pressed key event with an Unidentified physical key and some text types its printable characters into the focused text field (text_field_focused(), the same test the IME path uses, and type_chars_into_screen, which every box's input goes through), and the event ends there. Nothing changes for events that have a key code.

Verification

Builds; clippy and rustfmt clean for the changed file (the only clippy error is the existing needless_borrow in horizon-world). Not tried: this is a macOS machine, and the Alt-code event shape (no physical key, text set) is from winit's Windows backend, as I read it, not something I could trigger here. If a field still takes no Alt code, the event arrives some other way.

Not done

Windows' Alt codes in the title screen's fields and the book/sign editors go through the same text_field_focused test; not checked one by one.

🤖 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/6309 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/alt-codes-text` --- ### 📝 Commits (1) - [`76b26c9`](https://github.com/horizon-rust/horizon/commit/76b26c980356313d00c9a9fdde03b7ae50e9ac10) Type the characters that come with no key (Windows Alt codes) into the focused text field ### 📊 Changes **1 file changed** (+17 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+17 -0) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally. Fixes #5844 ## What was wrong An Alt code (Alt held, digits on the numeric keypad) makes Windows send a `WM_CHAR` with the composed character once Alt is released, with no key of its own. winit delivers it as a `KeyboardInput` with `PhysicalKey::Unidentified` and the character in `text`. Horizon's key handlers (`chat_key`, the other screens', the inventory search...) all begin with `let PhysicalKey::Code(key) = event.physical_key else { return }`, so the character was dropped. Vanilla's `charTyped` callback types it in the focused field. ## What changes `window_event` (`game.rs`): a pressed key event with an `Unidentified` physical key and some text types its printable characters into the focused text field (`text_field_focused()`, the same test the IME path uses, and `type_chars_into_screen`, which every box's input goes through), and the event ends there. Nothing changes for events that have a key code. ## Verification Builds; clippy and rustfmt clean for the changed file (the only clippy error is the existing `needless_borrow` in `horizon-world`). Not tried: this is a macOS machine, and the Alt-code event shape (no physical key, text set) is from winit's Windows backend, as I read it, not something I could trigger here. If a field still takes no Alt code, the event arrives some other way. ## Not done Windows' Alt codes in the title screen's fields and the book/sign editors go through the same `text_field_focused` test; not checked one by one. 🤖 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 06:26:36 +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#6786
No description provided.