From 5bc981e577d1b088cc5c5c13b7003e09ebff24d0 Mon Sep 17 00:00:00 2001 From: Cosmic <84875247+Online5277@users.noreply.github.com> Date: Fri, 16 Oct 2026 12:07:39 -0400 Subject: [PATCH] Match world-list search hints and detail placement --- crates/horizon-client/src/title.rs | 12 +++++----- crates/horizon-client/src/title/tests.rs | 28 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/crates/horizon-client/src/title.rs b/crates/horizon-client/src/title.rs index 31a51939b..2a9f0fdf9 100644 --- a/crates/horizon-client/src/title.rs +++ b/crates/horizon-client/src/title.rs @@ -839,13 +839,15 @@ impl Title { self.search_focused, self.started, ); - if self.search.is_empty() { - batch.text( + if self.search.is_empty() && !self.search_focused { + batch.text_styled( atlas, - &lang::get_or("gui.selectWorld.search", "Search..."), + &Text::literal(lang::get_or("gui.selectWorld.search", "Search...")) + .italic() + .with_color(crate::text::GRAY), (w / 2.0).floor() - 96.0, 27.0, - rgba(128, 128, 128, 255), + u32::MAX, true, ); } @@ -921,7 +923,7 @@ impl Title { atlas, &details, x + 35.0, - y + 22.0, + y + 21.0, rgba(128, 128, 128, 255), true, ); diff --git a/crates/horizon-client/src/title/tests.rs b/crates/horizon-client/src/title/tests.rs index c994885d8..4f759f960 100644 --- a/crates/horizon-client/src/title/tests.rs +++ b/crates/horizon-client/src/title/tests.rs @@ -625,6 +625,34 @@ fn delete_removes_links_without_following_them() { assert!(outside.join("keep.txt").is_file()); } +#[test] +fn world_search_hint_is_gray_and_only_shown_empty_and_unfocused() { + let mut f = Fixture::new(); + f.world("World", "World"); + f.select(); + let atlas = crate::hud::HudAtlas::build(Path::new("/nonexistent/horizon-test-assets")).unwrap(); + let draw = |title: &Title| { + let mut batch = HudBatch::new([480, 262]); + title.draw(&atlas, &mut batch, (0.0, 0.0), true); + batch + }; + let has_hint = |batch: &HudBatch| { + batch + .vertices + .iter() + .any(|v| v.color == rgba(170, 170, 170, 255) && (21.0..41.0).contains(&v.pos[1])) + }; + assert!(has_hint(&draw(&f.title))); + + f.title.click(240.0, 31.0, (480.0, 262.0)); + assert!(f.title.search_focused); + assert!(!has_hint(&draw(&f.title))); + f.title.type_text("World"); + f.title.click(240.0, 60.0, (480.0, 262.0)); + assert!(!f.title.search_focused); + assert!(!has_hint(&draw(&f.title))); +} + #[test] fn scrolled_world_list_draws_inside_the_list_and_drags_its_scroller() { let mut f = Fixture::new();