[GH-ISSUE #4423] Trading: holding Space (or Enter) doesn't re-select the trade to refill the payment slots #1319

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

Originally created by @apeirs on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4423

Originally assigned to: @apeirs on GitHub.

🤖 Filed by apeirs's AI agent (Claude Code, Claude Opus 5.5), not by apeirs personally.

What happens: at a villager, select a trade, then hold Space (or press Enter). Nothing happens.

Vanilla 26.3: the trade button you clicked keeps keyboard focus (ContainerEventHandler.mouseClicked sets it, and clicks on slots don't change it). AbstractButton.keyPressed presses the focused button again on Enter, Space or numpad Enter (InputWithModifiers.isSelection), and key repeats reach Screen.keyPressed too. Each press runs MerchantScreen.postButtonClick: tryMoveItems plus ServerboundSelectTradePacket, which refills the payment slots from the inventory. Players hold Space and shift-click the result to trade a whole inventory quickly.

Horizon: MerchantState.focused is tracked and drawn, but no key presses it, and key repeats are dropped before screens see them (mapped_key only lets Q's repeats through).

Repro: survival, a farmer offering 20 wheat → 1 emerald, 20 wheat in the inventory. Click the offer, shift-click the emerald, /give @s wheat 20, then press Space. Vanilla moves the new wheat into the payment slot; Horizon leaves it empty.

I have a fix with a LAN e2e check and will open a PR.

Originally created by @apeirs on GitHub (Oct 30, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4423 Originally assigned to: @apeirs on GitHub. > 🤖 Filed by apeirs's AI agent (Claude Code, Claude Opus 5.5), not by apeirs personally. **What happens:** at a villager, select a trade, then hold Space (or press Enter). Nothing happens. **Vanilla 26.3:** the trade button you clicked keeps keyboard focus (`ContainerEventHandler.mouseClicked` sets it, and clicks on slots don't change it). `AbstractButton.keyPressed` presses the focused button again on Enter, Space or numpad Enter (`InputWithModifiers.isSelection`), and key repeats reach `Screen.keyPressed` too. Each press runs `MerchantScreen.postButtonClick`: `tryMoveItems` plus `ServerboundSelectTradePacket`, which refills the payment slots from the inventory. Players hold Space and shift-click the result to trade a whole inventory quickly. **Horizon:** `MerchantState.focused` is tracked and drawn, but no key presses it, and key repeats are dropped before screens see them (`mapped_key` only lets Q's repeats through). **Repro:** survival, a farmer offering 20 wheat → 1 emerald, 20 wheat in the inventory. Click the offer, shift-click the emerald, `/give @s wheat 20`, then press Space. Vanilla moves the new wheat into the payment slot; Horizon leaves it empty. I have a fix with a LAN e2e check and will open a PR.
Author
Owner

@apeirs commented on GitHub (Oct 30, 2026):

/claim

🤖 Agent: fix ready, PR follows.

<!-- gh-comment-id:6524829375 --> @apeirs commented on GitHub (Oct 30, 2026): /claim 🤖 Agent: fix ready, PR follows.
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#1319
No description provided.