[PR #3867] [MERGED] Screenshots: the key works with chat, a sign or a book open #5256

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3867
Author: @bxnjxmin27
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/3689-screenshot-while-chat


📝 Commits (1)

  • c3fdf71 Screenshots: the key works with chat, a sign or a book open

📊 Changes

3 files changed (+30 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+12 -1)
📝 crates/horizon-client/src/game/chat.rs (+14 -0)
📝 crates/horizon-client/src/game/control.rs (+4 -0)

📄 Description

🤖 Opened by bxnjxmin27's AI agent (opencode, DeepSeek V4.1 Flash), not by bxnjxmin27 personally.

What and why

Fixes #3689. A screenshot could not be taken while the chat was open.

F2 was handled in Game::key_pressed, which a screen with a text box never
reaches: chat, signs, books, the command block and the search boxes take the key
first, so F2 did nothing there.

Vanilla handles it the other way round — KeyboardHandler.keyPress calls
Minecraft.handleGlobalKeyPress before the screen sees the key, so
key.fullscreen and key.screenshot work on every screen. The fullscreen half
of that already existed here as a window shortcut in window_event; this adds
the screenshot half beside it and removes the per-key arm. Two details come
along with the move:

  • the mapping decides, not the physical key: key.screenshot (F2 by default)
    is read from the options, so a rebound key works and F2 stops taking pictures
    when it is bound to something else. key.screenshot was registered in
    keybinds.rs but never consulted before.
  • a held debug modifier (key.debug.modifier, F3) suppresses the shortcut, as
    handleGlobalKeyPress does, and a key repeat does not take a second picture.

horizon-ctl key takes the same shortcut, so an agent drives what a player
does (that is also how I checked it, below).

Vanilla reference

net.minecraft.client.KeyboardHandler#keyPress line 469 calls
Minecraft#handleGlobalKeyPress first, and Minecraft#handleGlobalKeyPress
(client) checks keyDebugModifier.isDown(), then keyFullscreen.matches(key),
then keyScreenshot.matches(key) → Screenshot.grab(this, controlDown), and
only then looks at the open screen. Same order here: the check sits next to the
existing fullscreen one, before debug_key, the screen branches and the text
boxes.

No harness: this is window input and screens, not gameplay. Checked by hand
instead (below).

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on laptop-aef6, against upstream/main at baa379d71, 5 min 29 s)

Check Result
Scope ✅ 3 files, +30 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 423 passed (33 s)
rustfmt ✅ (6 s)
clippy ✅ (2 min 6 s)
tests: horizon-client ❌ 674 passed, 1 failed (2 min 42 s)
doc tests ✅ 0 passed (2 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)

The one failing test is not from this change:
entity_nbt::axolotl_nbt_tests::bucket_cooldown_and_brain_memories_survive_and_expired_cooldown_is_removed
(assertion failed: m.has_effect("glowing"), entity_nbt.rs:2820) fails the
same way on upstream/main with these three files stashed.

Screenshots

Nothing on screen changes, so there is no before/after. How I checked it, with
the fast profile and --offscreen:

  1. horizon-ctl launch --world W --creative --offscreen --wait
  2. horizon-ctl key t down → screen=chat
  3. horizon-ctl key f2 down → a new screenshots/2026-10-29_20.58.01.png
    (1280×720) appeared, and the chat reported
    Saved screenshot as 2026-10-29_20.58.01.png.
  4. Typed into the chat box first, pressed F2 again: the text stayed in the box,
    the chat reported the second picture, and it shows the message.

horizon-ctl key is deliberate: it is the same code a physical F2 reaches now.

🤖 Generated with opencode


🔄 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/3867 **Author:** [@bxnjxmin27](https://github.com/bxnjxmin27) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/3689-screenshot-while-chat` --- ### 📝 Commits (1) - [`c3fdf71`](https://github.com/horizon-rust/horizon/commit/c3fdf7192df4333d77a2c9cf1a671342125ea1ba) Screenshots: the key works with chat, a sign or a book open ### 📊 Changes **3 files changed** (+30 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+12 -1) 📝 `crates/horizon-client/src/game/chat.rs` (+14 -0) 📝 `crates/horizon-client/src/game/control.rs` (+4 -0) </details> ### 📄 Description > 🤖 Opened by bxnjxmin27's AI agent (opencode, DeepSeek V4.1 Flash), not by bxnjxmin27 personally. ## What and why Fixes #3689. A screenshot could not be taken while the chat was open. `F2` was handled in `Game::key_pressed`, which a screen with a text box never reaches: chat, signs, books, the command block and the search boxes take the key first, so F2 did nothing there. Vanilla handles it the other way round — `KeyboardHandler.keyPress` calls `Minecraft.handleGlobalKeyPress` before the screen sees the key, so `key.fullscreen` and `key.screenshot` work on every screen. The fullscreen half of that already existed here as a window shortcut in `window_event`; this adds the screenshot half beside it and removes the per-key arm. Two details come along with the move: - the mapping decides, not the physical key: `key.screenshot` (F2 by default) is read from the options, so a rebound key works and F2 stops taking pictures when it is bound to something else. `key.screenshot` was registered in `keybinds.rs` but never consulted before. - a held debug modifier (`key.debug.modifier`, F3) suppresses the shortcut, as `handleGlobalKeyPress` does, and a key repeat does not take a second picture. `horizon-ctl key` takes the same shortcut, so an agent drives what a player does (that is also how I checked it, below). ## Vanilla reference `net.minecraft.client.KeyboardHandler#keyPress` line 469 calls `Minecraft#handleGlobalKeyPress` first, and `Minecraft#handleGlobalKeyPress` (client) checks `keyDebugModifier.isDown()`, then `keyFullscreen.matches(key)`, then `keyScreenshot.matches(key)` → `Screenshot.grab(this, controlDown)`, and only then looks at the open screen. Same order here: the check sits next to the existing fullscreen one, before `debug_key`, the screen branches and the text boxes. No harness: this is window input and screens, not gameplay. Checked by hand instead (below). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on laptop-aef6, against upstream/main at baa379d71, 5 min 29 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +30 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 423 passed (33 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (2 min 6 s) | | tests: horizon-client | ❌ 674 passed, 1 failed (2 min 42 s) | | doc tests | ✅ 0 passed (2 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) | The one failing test is not from this change: `entity_nbt::axolotl_nbt_tests::bucket_cooldown_and_brain_memories_survive_and_expired_cooldown_is_removed` (`assertion failed: m.has_effect("glowing")`, `entity_nbt.rs:2820`) fails the same way on `upstream/main` with these three files stashed. ## Screenshots Nothing on screen changes, so there is no before/after. How I checked it, with the fast profile and `--offscreen`: 1. `horizon-ctl launch --world W --creative --offscreen --wait` 2. `horizon-ctl key t down` → `screen=chat` 3. `horizon-ctl key f2 down` → a new `screenshots/2026-10-29_20.58.01.png` (1280×720) appeared, and the chat reported `Saved screenshot as 2026-10-29_20.58.01.png`. 4. Typed into the chat box first, pressed F2 again: the text stayed in the box, the chat reported the second picture, and it shows the message. `horizon-ctl key` is deliberate: it is the same code a physical F2 reaches now. 🤖 Generated with [opencode](https://opencode.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:11:19 +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#5256
No description provided.