From df08a913d183e67446616bbd81fad54103d68b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 21 Aug 2026 07:35:18 +0300 Subject: [PATCH] fix(ui): wrap notice plate text --- crates/app/src/tests/layout.rs | 25 +++++++++++++++++++++++++ crates/app/src/ui/stance.rs | 19 ++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index f168fa2..85e2e3d 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -1930,6 +1930,31 @@ fn the_notice_plate_cannot_reach_the_bench_at_any_height() { ); } } +/// The renderer only wraps text when the text measurement receives a definite +/// width and normal whitespace. This source-level guard keeps both declarations +/// on the notice plate: `max_w` alone limits max-content after that measurement +/// and silently permits one-line overflow. It cannot inspect GPUI's painted +/// lines; only live driving can confirm the full notice actually wrapped. +#[test] +fn the_notice_plate_declares_a_bounded_wrapping_text_layout() { + let stance = src_text("ui/stance.rs"); + let notice_start = stance.find("fn notice_plate(").expect("notice plate moved or renamed"); + let notice_end = stance[notice_start..] + .find("\n/// Thin strip") + .map(|end| notice_start + end) + .expect("notice plate no longer precedes the ledger"); + let plate = &stance[notice_start..notice_end]; + + assert!( + plate.contains(".w_full()") && plate.contains(".max_w(px(480.))"), + "notice plate lacks a definite width bounded to 480 px; max_w alone does not wrap text" + ); + assert!( + plate.contains(".whitespace_normal()"), + "notice plate no longer explicitly requests GPUI's wrapping whitespace mode" + ); +} + /// A round trip through the file: what is saved is what the next load reads /// back, one seam touched and the other left at its default -- a scratch diff --git a/crates/app/src/ui/stance.rs b/crates/app/src/ui/stance.rs index 7c1041f..4d9ed30 100644 --- a/crates/app/src/ui/stance.rs +++ b/crates/app/src/ui/stance.rs @@ -594,14 +594,19 @@ fn notice_plate(message: SharedString, bench_h: f32) -> impl IntoElement { .absolute() .bottom(px(notice_bottom_offset(bench_h))) .left(px(12.)) - // Wide enough to hold a refusal-plus-remedy sentence in two or three - // lines rather than one line cut mid-word: the ledger strip below is - // the one place that must stay a single truncated line (it also - // carries the project identity, export progress and the timecode on - // the same row), so this plate is the surface with room, and it - // takes it. + // `max_w` only caps a box after GPUI has measured its text at + // max-content width. `w_full` supplies a definite width to that + // measurement (then `max_w` bounds it at 480 px), and normal + // whitespace gives the text system permission to shape every word + // into the resulting lines. Keep this a block: as a flex child the + // text's automatic min-content width can overflow its own plate. + // + // No fixed height: GPUI's shaped lines contribute their actual + // default `phi()` line boxes, so two or three lines grow upward from + // this bottom anchor without reaching down over the bench lanes. + .w_full() .max_w(px(480.)) - .flex() + .whitespace_normal() .px(px(10.)) .py(px(6.)) .rounded(px(2.))