[PR #6427] [CLOSED] Button, slider and title-screen labels wider than their widget scroll like vanilla's #6865

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6427
Author: @mariuslozo-boop
Created: 11/1/2026
Status: ❌ Closed

Base: main ← Head: fix/ui-button-scrolling


📝 Commits (6)

  • 7a9207e Buttons scroll a label wider than they are, instead of panicking in clamp (#6129)
  • 3ef7e2e Pack screen harness: scrolling button labels in 8 languages at a fixed clock (#6129)
  • bee5c7d Buttons reach the label through vanilla's scrolling chain; drop the unreproducible offset hash (#6129)
  • 76e2ffd Port ledger: ClickableStyleFinder.acceptScrolling's note no longer says there is no scrolling text (#6129)
  • b3fab1f Button, slider and title-screen labels wider than their widget scroll like vanilla's (#6229)
  • f0bbb9b A label beside a TextAndIcon button's icon is kept clear of it; vanilla citations sit on the fns that hold the bodies (#6229)

📊 Changes

13 files changed (+1294 additions, -63 deletions)

View changed files

📝 crates/horizon-client-render/src/options_ui.rs (+1 -1)
📝 crates/horizon-client-render/src/pack_screen.rs (+155 -13)
📝 crates/horizon-client-render/src/screen_draw.rs (+283 -7)
📝 crates/horizon-client-render/src/ui.rs (+553 -11)
📝 crates/horizon-client/examples/probe/pack_screen_fixture.rs (+16 -5)
📝 crates/horizon-client/src/game/chat.rs (+1 -0)
📝 crates/horizon-client/src/title.rs (+205 -10)
📝 crates/horizon-client/src/title/create_world.rs (+16 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPackScreenOracle.java (+39 -2)
📝 tools/port_map/client2-009.tsv (+7 -7)
📝 tools/port_map/client2-011.tsv (+1 -1)
📝 tools/port_map/client2-012.tsv (+1 -1)
📝 tools/test_pack_screen_parity.py (+16 -5)

📄 Description

🤖 Opened by mariuslozo-boop's AI agent (Claude Code, Claude Sonnet 5.5 + Claude Opus 5.5 review), not by mariuslozo-boop personally.

What and why

Fixes #6229. Stacked on #6293 (#6129), whose scrolling helpers it reuses. Until #6293 merges, this diff also shows its 4 commits; the change here is the last 2 (b3fab1f0a, f0bbb9b06).

In vanilla 26.3, a button, slider, cycle-button or tab label that doesn't fit its widget slides back and forth inside it. Horizon cut such labels after the last character that fits (ui::centered_text) on the options pages, or drew them past the button over its neighbours on the title screens. It shows in English too:

  • Video Settings: Graphics API: Prefer Vulkan (Experimental) (216 px in 150 px) showed as Graphics API: Prefer Vulkan;
  • Simulation Distance: 32 Chunks showed as ...32 Chunk;
  • Key Binds while rebinding: > Left Control < showed as > Left Contro.

This makes them scroll through the vanilla chain #6293 ports (scrolling_string_over_contents, scrolling_with_default_center, scroll_offset):

  • ui::button, button_as, slider, slider_ext (AbstractButton.extractDefaultLabel, AbstractSliderButton.java:78): margin 2. A slider scrolls its whole message, value included. A label that fits still goes through centered_text and is drawn exactly as before.
  • Title-screen buttons (Main Menu, Select World, Create World, Multiplayer, Edit Server, Direct Connection): Button::draw_label in title.rs clips and scrolls instead of drawing unclipped. A button with a trailing icon keeps the label clear of it, as SpriteIconButton.TextAndIcon does (left = x + 2, right = x + w - icon - 4, and the label that fits clamped clear of the icon).
  • Create World tabs (MenuTabBar.MenuTabButton): margin 1 and the tab's own box. No language overflows a tab today, so this path is covered by a unit test only.
  • Clock: new button_at, button_as_at, slider_ext_at take now_ms. The old names read hud_overlays::now_ms(), the way ui:: widgets already read the clock (the caret blink, the double-click timer). Tests pass a fixed clock.
  • Clipping is done on the label's own quads (HudBatch::clip_since, exact edges with adjusted texture coordinates), so inside a list that clips its rows (Options, Key Binds, game rules, dialogs...) the two clips intersect.
  • Text colour and shadow as vanilla: white when active, A0A0A0 when inactive, shadow kept.
  • Untouched: centered_text for screen titles and text lines (vanilla doesn't scroll those). Port ledger rows updated (client2-009/011/012.tsv).

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

  • ActiveTextCollector.defaultScrollingHelper (ActiveTextCollector.java:62-84).
  • AbstractWidget.extractScrollingStringOverContents (AbstractWidget.java:92-98).
  • AbstractButton.extractDefaultLabel (AbstractButton.java:39-40).
  • AbstractSliderButton (AbstractSliderButton.java:67-80).
  • CycleButton (CycleButton.java:72-82).
  • MenuTabBar.MenuTabButton (MenuTabBar.java:141-147).
  • SpriteIconButton.TextAndIcon (SpriteIconButton.java:266-276).
  • CommonComponents.optionNameValue.

Harness: none draws ui::button, ui::slider or the title-screen buttons, so none needs a fixed clock for this. On Windows, test_pack_screen_parity passes on this branch. test_options_parity fails only on syncChunkWrites: vanilla defaults it to true on Windows and Horizon writes false (options_file.rs:238). That is unrelated to this change.

Other projects' code

none

Self-check

New tests. With the overflow check forced off (the old behaviour), every test that expects a scroll or a clip fails; with the change they pass.

  • ui::scroll_tests (8, plus 1 ignored real-font test):
    • button, slider and tab (through the real Create World tab box);
    • disabled colour; a label that fits (unchanged); one pixel over; a box with no room;
    • a scrolling label inside a clipped list is clipped to both;
    • the ignored test confirms the English cases above with the real font and a local Language; the global language is never changed.
  • title::button_label_tests (4):
    • a long label scrolls; a label that fits is unchanged;
    • a label beside an icon;
    • a label that fits beside an icon is moved clear of it. Without the clamp it is drawn 7 px too far right, under the icon, on the first-launch Accessibility screen in about 40 languages.

Real client (offscreen, isolated home, 1280x720, five screenshots about 2.2 s apart):

  • en_us Video Settings: Graphics API: Prefer Vulkan (Experimental) and Simulation Distance: 32 Chunks slide inside their 150 px buttons, nothing past the edges.
  • en_us Key Binds: > Left Control < scrolls inside the 75 px button.
  • so_so Create World: the World Type label (590 px) scrolls inside its button instead of crossing the screen.
  • hi_in Multiplayer: the footer labels no longer spill over their neighbours.

pr_ready (tools/pr_ready.py --base fix/pack-screen-long-label on PCDKBLENDER, against fix/pack-screen-long-label at 76e2ffdb8, 15 min 30 s)

Check Result
Scope ⚠️ 6 files, +782 −29; 811 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 585 passed (1 min 30 s)
rustfmt ✅ (24 s)
clippy ✅ (27 s)
tests: horizon-client, horizon-client-render ❌ 1192 passed, 1 failed (13 min 0 s)
doc tests ✅ 0 passed (5 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 ❌ 382 affected, (1 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)
  • Scope: about 310 of the lines are code and about 470 are tests. A split into ui:: widgets and title-screen buttons would leave the second needing the first's helpers (a three-deep stack on #6293), and the first still over 500 lines from its tests alone, so it isn't split.
  • The one failure: armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation, which fails on main too (#6235 / #6236). cargo stops at that binary, so the rest were run separately:
    • horizon-client-render: 918 passed (34 ignored), plus 7 integration tests;
    • the horizon-client game binary: 541 passed, 2 failed (game::tnt water current and soul-sand bubble column, both failing on main, also #6235 / #6236);
    • horizon-ctl and the 11 integration test binaries pass.
  • Parity: run on Windows, where the runner needs fcntl and can't start.
  • Threads: RUST_TEST_THREADS=2 was set (GPU render tests hang with more threads on this machine, #5238). Two GPU arena tests hung during one full run while other game processes were using the GPU. Run alone, all 13 pass.

Not tested:

  • Buttons drawn by hand outside ui::button and the title loop (sign edit "Done", creative page arrows, trading offers, icon-only buttons): checked, and none is a vanilla Button whose label can overflow today.
  • Real-client screens other than the four above. The dialogs, advancements, stats, trading and LAN screens go through the same ui::button. Other window sizes and GUI scales.
  • Mouse hover on a scrolling label, and the narrator.

Found along the way, not changed here:

  • The Stats screen tabs are placed slightly differently from vanilla (y 8 vs 10, odd widths 1 px left, unselected active tabs grey).
  • Sign edit's "Done" is a hard-coded English literal, not gui.done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RodDbPWCByh96WKcbiEQpB


🔄 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/6427 **Author:** [@mariuslozo-boop](https://github.com/mariuslozo-boop) **Created:** 11/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/ui-button-scrolling` --- ### 📝 Commits (6) - [`7a9207e`](https://github.com/horizon-rust/horizon/commit/7a9207e1e214adc136b55ac5ec6c9e0f5788505e) Buttons scroll a label wider than they are, instead of panicking in clamp (#6129) - [`3ef7e2e`](https://github.com/horizon-rust/horizon/commit/3ef7e2e8f712515be1776214da6ae9e532ee8f56) Pack screen harness: scrolling button labels in 8 languages at a fixed clock (#6129) - [`bee5c7d`](https://github.com/horizon-rust/horizon/commit/bee5c7da72c358cea0f17869d8a10c7cb354e26a) Buttons reach the label through vanilla's scrolling chain; drop the unreproducible offset hash (#6129) - [`76e2ffd`](https://github.com/horizon-rust/horizon/commit/76e2ffdb8705fe37076959786bb1bfcbb7086c94) Port ledger: ClickableStyleFinder.acceptScrolling's note no longer says there is no scrolling text (#6129) - [`b3fab1f`](https://github.com/horizon-rust/horizon/commit/b3fab1f0ae78b802c6a0d9b71b54fa1c4eaa21c1) Button, slider and title-screen labels wider than their widget scroll like vanilla's (#6229) - [`f0bbb9b`](https://github.com/horizon-rust/horizon/commit/f0bbb9b061aa41f8a84ea4d3cb17f2c24e25b376) A label beside a TextAndIcon button's icon is kept clear of it; vanilla citations sit on the fns that hold the bodies (#6229) ### 📊 Changes **13 files changed** (+1294 additions, -63 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/options_ui.rs` (+1 -1) 📝 `crates/horizon-client-render/src/pack_screen.rs` (+155 -13) 📝 `crates/horizon-client-render/src/screen_draw.rs` (+283 -7) 📝 `crates/horizon-client-render/src/ui.rs` (+553 -11) 📝 `crates/horizon-client/examples/probe/pack_screen_fixture.rs` (+16 -5) 📝 `crates/horizon-client/src/game/chat.rs` (+1 -0) 📝 `crates/horizon-client/src/title.rs` (+205 -10) 📝 `crates/horizon-client/src/title/create_world.rs` (+16 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaPackScreenOracle.java` (+39 -2) 📝 `tools/port_map/client2-009.tsv` (+7 -7) 📝 `tools/port_map/client2-011.tsv` (+1 -1) 📝 `tools/port_map/client2-012.tsv` (+1 -1) 📝 `tools/test_pack_screen_parity.py` (+16 -5) </details> ### 📄 Description > 🤖 Opened by mariuslozo-boop's AI agent (Claude Code, Claude Sonnet 5.5 + Claude Opus 5.5 review), not by mariuslozo-boop personally. ## What and why Fixes #6229. **Stacked on #6293** (#6129), whose scrolling helpers it reuses. Until #6293 merges, this diff also shows its 4 commits; the change here is the last 2 (`b3fab1f0a`, `f0bbb9b06`). In vanilla 26.3, a button, slider, cycle-button or tab label that doesn't fit its widget slides back and forth inside it. Horizon cut such labels after the last character that fits (`ui::centered_text`) on the options pages, or drew them past the button over its neighbours on the title screens. It shows in English too: - Video Settings: `Graphics API: Prefer Vulkan (Experimental)` (216 px in 150 px) showed as `Graphics API: Prefer Vulkan`; - `Simulation Distance: 32 Chunks` showed as `...32 Chunk`; - Key Binds while rebinding: `> Left Control <` showed as `> Left Contro`. This makes them scroll through the vanilla chain #6293 ports (`scrolling_string_over_contents`, `scrolling_with_default_center`, `scroll_offset`): - **`ui::button`, `button_as`, `slider`, `slider_ext`** (`AbstractButton.extractDefaultLabel`, `AbstractSliderButton.java:78`): margin 2. A slider scrolls its whole message, value included. A label that fits still goes through `centered_text` and is drawn exactly as before. - **Title-screen buttons** (Main Menu, Select World, Create World, Multiplayer, Edit Server, Direct Connection): `Button::draw_label` in `title.rs` clips and scrolls instead of drawing unclipped. A button with a trailing icon keeps the label clear of it, as `SpriteIconButton.TextAndIcon` does (`left = x + 2`, `right = x + w - icon - 4`, and the label that fits clamped clear of the icon). - **Create World tabs** (`MenuTabBar.MenuTabButton`): margin 1 and the tab's own box. No language overflows a tab today, so this path is covered by a unit test only. - **Clock:** new `button_at`, `button_as_at`, `slider_ext_at` take `now_ms`. The old names read `hud_overlays::now_ms()`, the way `ui::` widgets already read the clock (the caret blink, the double-click timer). Tests pass a fixed clock. - **Clipping** is done on the label's own quads (`HudBatch::clip_since`, exact edges with adjusted texture coordinates), so inside a list that clips its rows (Options, Key Binds, game rules, dialogs...) the two clips intersect. - **Text colour and shadow** as vanilla: white when active, A0A0A0 when inactive, shadow kept. - **Untouched:** `centered_text` for screen titles and text lines (vanilla doesn't scroll those). Port ledger rows updated (`client2-009/011/012.tsv`). ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference - `ActiveTextCollector.defaultScrollingHelper` (`ActiveTextCollector.java:62-84`). - `AbstractWidget.extractScrollingStringOverContents` (`AbstractWidget.java:92-98`). - `AbstractButton.extractDefaultLabel` (`AbstractButton.java:39-40`). - `AbstractSliderButton` (`AbstractSliderButton.java:67-80`). - `CycleButton` (`CycleButton.java:72-82`). - `MenuTabBar.MenuTabButton` (`MenuTabBar.java:141-147`). - `SpriteIconButton.TextAndIcon` (`SpriteIconButton.java:266-276`). - `CommonComponents.optionNameValue`. Harness: none draws `ui::button`, `ui::slider` or the title-screen buttons, so none needs a fixed clock for this. On Windows, `test_pack_screen_parity` passes on this branch. `test_options_parity` fails only on `syncChunkWrites`: vanilla defaults it to true on Windows and Horizon writes false (`options_file.rs:238`). That is unrelated to this change. ## Other projects' code none ## Self-check New tests. With the overflow check forced off (the old behaviour), every test that expects a scroll or a clip fails; with the change they pass. - `ui::scroll_tests` (8, plus 1 ignored real-font test): - button, slider and tab (through the real Create World tab box); - disabled colour; a label that fits (unchanged); one pixel over; a box with no room; - a scrolling label inside a clipped list is clipped to both; - the ignored test confirms the English cases above with the real font and a local `Language`; the global language is never changed. - `title::button_label_tests` (4): - a long label scrolls; a label that fits is unchanged; - a label beside an icon; - a label that fits beside an icon is moved clear of it. Without the clamp it is drawn 7 px too far right, under the icon, on the first-launch Accessibility screen in about 40 languages. Real client (offscreen, isolated home, 1280x720, five screenshots about 2.2 s apart): - en_us Video Settings: `Graphics API: Prefer Vulkan (Experimental)` and `Simulation Distance: 32 Chunks` slide inside their 150 px buttons, nothing past the edges. - en_us Key Binds: `> Left Control <` scrolls inside the 75 px button. - so_so Create World: the World Type label (590 px) scrolls inside its button instead of crossing the screen. - hi_in Multiplayer: the footer labels no longer spill over their neighbours. **pr_ready** (`tools/pr_ready.py --base fix/pack-screen-long-label` on PCDKBLENDER, against fix/pack-screen-long-label at 76e2ffdb8, 15 min 30 s) | Check | Result | | --- | --- | | Scope | ⚠️ 6 files, +782 −29; 811 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 585 passed (1 min 30 s) | | rustfmt | ✅ (24 s) | | clippy | ✅ (27 s) | | tests: horizon-client, horizon-client-render | ❌ 1192 passed, 1 failed (13 min 0 s) | | doc tests | ✅ 0 passed (5 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 | ❌ 382 affected, (1 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | - **Scope:** about 310 of the lines are code and about 470 are tests. A split into `ui::` widgets and title-screen buttons would leave the second needing the first's helpers (a three-deep stack on #6293), and the first still over 500 lines from its tests alone, so it isn't split. - **The one failure:** `armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation`, which fails on main too (#6235 / #6236). cargo stops at that binary, so the rest were run separately: - horizon-client-render: 918 passed (34 ignored), plus 7 integration tests; - the horizon-client game binary: 541 passed, 2 failed (`game::tnt` water current and soul-sand bubble column, both failing on main, also #6235 / #6236); - horizon-ctl and the 11 integration test binaries pass. - **Parity:** run on Windows, where the runner needs `fcntl` and can't start. - **Threads:** `RUST_TEST_THREADS=2` was set (GPU render tests hang with more threads on this machine, #5238). Two GPU arena tests hung during one full run while other game processes were using the GPU. Run alone, all 13 pass. Not tested: - Buttons drawn by hand outside `ui::button` and the title loop (sign edit "Done", creative page arrows, trading offers, icon-only buttons): checked, and none is a vanilla `Button` whose label can overflow today. - Real-client screens other than the four above. The dialogs, advancements, stats, trading and LAN screens go through the same `ui::button`. Other window sizes and GUI scales. - Mouse hover on a scrolling label, and the narrator. Found along the way, not changed here: - The Stats screen tabs are placed slightly differently from vanilla (y 8 vs 10, odd widths 1 px left, unselected active tabs grey). - Sign edit's "Done" is a hard-coded English literal, not `gui.done`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RodDbPWCByh96WKcbiEQpB --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:28:20 +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#6865
No description provided.