[PR #5068] [MERGED] Center widget labels with vanilla integer half-widths #6039

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5068
Author: @doodlyyousuf
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/4988-ui-label-centering


📝 Commits (1)

  • 714e6e5 Center widget labels with vanilla integer half-widths

📊 Changes

1 file changed (+16 additions, -8 deletions)

View changed files

📝 crates/horizon-client-render/src/ui.rs (+16 -8)

📄 Description

🤖 Opened by doodlyyousuf's AI agent (OhMyAgent, grok-4.6), not by doodlyyousuf personally.

What and why

Some widget labels sat one pixel left of vanilla. centered_text floored (w - width) / 2. Vanilla's TextAlignment.CENTER.calculateLeft is anchor - width / 2 at the box's integer centre (x + w/2 - width/2). On even-width buttons that difference is one pixel for odd-width labels, about half of UI text.

Fixes #4988

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

TextAlignment.CENTER.calculateLeft (anchor - width / 2). AbstractWidget.renderScrollingString centres the label in the widget. Unit test ui::tests::centered_label_matches_vanilla_integer_center passed.

Other projects' code

none

Self-check

cargo test -p horizon-client-render --lib ui::tests::centered_label_matches_vanilla_integer_center -- --exact
ok

Public tree check passed on commit.

🤖 Generated with Grok 4.6


🔄 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/5068 **Author:** [@doodlyyousuf](https://github.com/doodlyyousuf) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/4988-ui-label-centering` --- ### 📝 Commits (1) - [`714e6e5`](https://github.com/horizon-rust/horizon/commit/714e6e52bdb8f40e975c6cec8e58bd3aa3732865) Center widget labels with vanilla integer half-widths ### 📊 Changes **1 file changed** (+16 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/ui.rs` (+16 -8) </details> ### 📄 Description > 🤖 Opened by doodlyyousuf's AI agent (OhMyAgent, grok-4.6), not by doodlyyousuf personally. ## What and why Some widget labels sat one pixel left of vanilla. `centered_text` floored `(w - width) / 2`. Vanilla's `TextAlignment.CENTER.calculateLeft` is `anchor - width / 2` at the box's integer centre (`x + w/2 - width/2`). On even-width buttons that difference is one pixel for odd-width labels, about half of UI text. Fixes #4988 ## 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 `TextAlignment.CENTER.calculateLeft` (`anchor - width / 2`). `AbstractWidget.renderScrollingString` centres the label in the widget. Unit test `ui::tests::centered_label_matches_vanilla_integer_center` passed. ## Other projects' code none ## Self-check ``` cargo test -p horizon-client-render --lib ui::tests::centered_label_matches_vanilla_integer_center -- --exact ok ``` Public tree check passed on commit. 🤖 Generated with Grok 4.6 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:48 +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#6039
No description provided.