diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index 4e5d8fd..9717e60 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -6343,6 +6343,17 @@ fn file_name(path: &std::path::Path) -> String { /// eight is more than a user will ever answer in a row. const NOTICES_MAX: usize = 8; +/// The narrowest a notice's *message* is allowed to be squeezed before its hint +/// gives up the line and drops below it. +/// +/// The bar is a message beside a hint, and at the 640x360 floor the picture +/// region it hangs under is narrower than the hint alone -- so the message was +/// squeezed to nothing and wrapped one character per line, which is a failure +/// rendered as a column of letters. Wide enough that a line of it is a phrase +/// rather than a word ladder, and narrow enough to still fit beside the hint in +/// any window worth putting two things on a line in. +const NOTICE_MIN_W: f32 = 180.; + /// The whole of the queue's policy, where it can be read at once and tested /// without a window: dedupe against the back, a ceiling, oldest out first. /// [`Player::notify_user`] is the door every message comes through; this is what diff --git a/crates/app/src/ui/overlays.rs b/crates/app/src/ui/overlays.rs index 543efe6..0397c44 100644 --- a/crates/app/src/ui/overlays.rs +++ b/crates/app/src/ui/overlays.rs @@ -147,6 +147,14 @@ impl Player { }) .flex_none() .flex() + // The hint keeps its own width, and at the 640x360 floor the + // picture region is narrower than the hint alone: with both on + // one line the message was squeezed to nothing and wrapped a + // character per line -- a notice rendered as a column of + // letters. Wrapping puts the hint on its own line instead, so + // the message keeps the whole width and the queue counter + // stays on screen under it. + .flex_wrap() .items_start() .gap(px(12.)) .px(px(12.)) @@ -170,7 +178,14 @@ impl Player { this.dismiss_notice(); cx.notify(); })) - .child(div().flex_1().min_w(px(0.)).child(notice)) + // Shrinkable, because a gpui text element measures its + // min-content as the *whole line* (`TextLayout::layout` only + // wraps against a definite width) -- without a `min_w` the + // message would refuse to shrink at all and run off the region + // instead. With a floor under it, it shrinks to that floor, + // which pushes the hint onto its own line and leaves the + // message the width it needs to wrap like a sentence. + .child(div().flex_1().min_w(px(NOTICE_MIN_W)).child(notice)) .child( div() .flex_none()