[PR #394] [MERGED] Vanilla text selection colours and blinking cursors in the creative search and anvil #2532

Closed
opened 2026-11-02 15:56:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/text-highlight


📝 Commits (1)

  • adef2bd Draw text selections with vanilla's colours and blink the field cursors

📊 Changes

9 files changed (+258 additions, -51 deletions)

View changed files

📝 crates/horizon-client/src/creative.rs (+7 -0)
📝 crates/horizon-client/src/game.rs (+14 -2)
📝 crates/horizon-client/src/game/clipboard.rs (+4 -3)
📝 crates/horizon-client/src/game/recipe_book.rs (+3 -6)
📝 crates/horizon-client/src/game/sign_edit.rs (+8 -0)
📝 crates/horizon-client/src/game/stations.rs (+12 -10)
📝 crates/horizon-client/src/hud.rs (+80 -22)
📝 crates/horizon-client/src/screen_draw.rs (+3 -6)
📝 crates/horizon-client/src/ui.rs (+127 -2)

📄 Description

Text selections now draw in vanilla's colours, and the creative search and anvil name box draw their cursor and Select All highlight as EditBox does. Part of #275.

What changed

  • Highlight colour (GuiGraphicsExtractor.textHighlight): vanilla paints an inverting white fill, then adds pure blue (GUI_TEXT_HIGHLIGHT, additive blend). Horizon only inverted, so selections showed black text on a light box with no blue. HudBatch gains an additive pipeline (Blend::Additive) and text_highlight(.., invert_text). The anvil's name box skips the inversion (setInvertHighlightedTextColor(false) in AnvilScreen).
  • Creative search and anvil name box (ui::append_field): the cursor blinks from when the field took the focus (300 ms on / 300 ms off, TextCursorUtils.isCursorVisible), becomes a bar once the field is full (50 characters), and Select All draws the highlight from one pixel before the text to the cursor. Before, the creative search showed a steady _ and the anvil blinked on a tick count.
  • Signs: a Select All line draws its highlight (AbstractSignEditScreen).

Book titles use a centred layout in 26.3; they are left for a follow-up.

How tested

  • A unit test draws the fields and checks the highlight's blend runs (invert, then additive; additive only for the anvil), its span (x-1 to the cursor, 11 high), the full-field bar and the blink.
  • In game (offscreen, the Mac mini's screen was locked): the creative search cursor blinks (stone / stone_ on alternate frames).
  • Not checked in game: Cmd+A itself. The control socket can't send a Select All shortcut and real key events can't reach a locked session, so the new additive pass has only run in the unit test.

Self-check:

cargo fmt --all --check                                   ok
cargo clippy --workspace --all-targets -- -D warnings     ok
cargo test -p horizon-client                              ok (689 + 44 + 15 + 2 + 2 + 2 on the integration commit)
tools/parity.py --changed origin/main                     80 passed, 0 failed (56 min), one run over an integration commit of all the inventory PRs (this one included)

Ludovic: in the creative search, type something and press Cmd+A. The text should turn blue on a light box. Do the same in the anvil, where the text keeps its colour and the box is blue.

🤖 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/394 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/text-highlight` --- ### 📝 Commits (1) - [`adef2bd`](https://github.com/horizon-rust/horizon/commit/adef2bdc24d1664dae1e69c77faafc521c496763) Draw text selections with vanilla's colours and blink the field cursors ### 📊 Changes **9 files changed** (+258 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/creative.rs` (+7 -0) 📝 `crates/horizon-client/src/game.rs` (+14 -2) 📝 `crates/horizon-client/src/game/clipboard.rs` (+4 -3) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+3 -6) 📝 `crates/horizon-client/src/game/sign_edit.rs` (+8 -0) 📝 `crates/horizon-client/src/game/stations.rs` (+12 -10) 📝 `crates/horizon-client/src/hud.rs` (+80 -22) 📝 `crates/horizon-client/src/screen_draw.rs` (+3 -6) 📝 `crates/horizon-client/src/ui.rs` (+127 -2) </details> ### 📄 Description Text selections now draw in vanilla's colours, and the creative search and anvil name box draw their cursor and Select All highlight as `EditBox` does. Part of #275. ## What changed - **Highlight colour** (`GuiGraphicsExtractor.textHighlight`): vanilla paints an inverting white fill, then adds pure blue (`GUI_TEXT_HIGHLIGHT`, additive blend). Horizon only inverted, so selections showed black text on a light box with no blue. `HudBatch` gains an additive pipeline (`Blend::Additive`) and `text_highlight(.., invert_text)`. The anvil's name box skips the inversion (`setInvertHighlightedTextColor(false)` in `AnvilScreen`). - **Creative search and anvil name box** (`ui::append_field`): the cursor blinks from when the field took the focus (300 ms on / 300 ms off, `TextCursorUtils.isCursorVisible`), becomes a bar once the field is full (50 characters), and Select All draws the highlight from one pixel before the text to the cursor. Before, the creative search showed a steady `_` and the anvil blinked on a tick count. - **Signs**: a Select All line draws its highlight (`AbstractSignEditScreen`). Book titles use a centred layout in 26.3; they are left for a follow-up. ## How tested - A unit test draws the fields and checks the highlight's blend runs (invert, then additive; additive only for the anvil), its span (x-1 to the cursor, 11 high), the full-field bar and the blink. - In game (offscreen, the Mac mini's screen was locked): the creative search cursor blinks (`stone` / `stone_` on alternate frames). - **Not checked in game**: Cmd+A itself. The control socket can't send a Select All shortcut and real key events can't reach a locked session, so the new additive pass has only run in the unit test. Self-check: ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client ok (689 + 44 + 15 + 2 + 2 + 2 on the integration commit) tools/parity.py --changed origin/main 80 passed, 0 failed (56 min), one run over an integration commit of all the inventory PRs (this one included) ``` **Ludovic**: in the creative search, type something and press Cmd+A. The text should turn blue on a light box. Do the same in the anvil, where the text keeps its colour and the box is blue. 🤖 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-02 15:56:58 +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#2532
No description provided.