red round 3 (fw-apps): fixes for fw-run-4 (runs/fw-run-4/fw-apps.md); committed by the lead

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dylan M. TaylorandClaude Opus 5.5 committed 2026-11-18 09:16:40 -05:00
1 parent ca26f06558
commit 0d650f4064
7 files changed
+11 -23

No files matched your search

+3 -3
View File
@@ -18,7 +18,7 @@ use craft_ui::notices::{Notice, NoticeLayout};
use craft_ui::patterns::form_dialogs::{
DialogFields, FieldValue, FormDialog, HostRequests, PagerStep, PanePager, Param, ParamRows, set_color_field, set_param_field,
};
use craft_ui::primitives::{ContentPainterCx, TextRun, fill_polygon};
use craft_ui::primitives::{ContentPainterCx, TextRun, Wrap, fill_polygon};
use craft_ui::runtime::env::{Env, Label};
use craft_ui::runtime::focus::{ActivateKeys, KeepKeys, KeyUse};
use craft_ui::runtime::overlay::CloseReason;
@@ -423,7 +423,7 @@ impl Component for PrintPreview<'_> {
// A message takes the lines it wraps to at this width, so a larger text size grows the part instead of
// overflowing it.
let message = match &self.sheet.content {
SheetContent::Message(message) => cx.layout_at(&TextRun::new(cx.env.resolve(message).as_str()), width).size().y,
SheetContent::Message(message) => cx.layout_at(&TextRun::new(cx.env.resolve(message).as_str()).wrap(Wrap::Wrap), width).size().y,
_ => 0.0,
};
Vec2::new(width, (width * aspect).max(message))
@@ -489,7 +489,7 @@ impl Component for PrintPreview<'_> {
let painter = ui.content_painter(cx);
painter.surface(cx.rect, SurfaceKind::Well, Corners::None);
let shown = cx.env.resolve(message);
let run = TextRun::new(shown.as_str()).color(style.ink);
let run = TextRun::new(shown.as_str()).wrap(Wrap::Wrap).color(style.ink);
centred_text(&painter, &run, cx.rect.center(), cx.rect.width());
return;
}
+2 -1
View File
@@ -293,7 +293,8 @@ fn long_list() -> (Rc<RefCell<Vec<CommentThread>>>, Rc<RefCell<CommentsPanelStat
let mut state = shown_state.borrow_mut();
let _ = CommentsPanel::new("Comments", &threads, &mut state).show(ui);
});
fixture.settle();
// A panel room is tall enough for the grown first card and the card below it to be in view together.
fixture.in_room(Room::Panel).settle();
state.borrow_mut().reveal(ThreadId(100));
fixture.settle();
(threads, state, fixture)
+3 -8
View File
@@ -182,15 +182,10 @@ impl<'a> FindBar<'a> {
.select_all(to_query)
.show(ui);
if to_query {
let taken = focus::request(ui.ctx(), FocusTarget::Id(edit.response.id));
eprintln!(
"DIAG asking_for_the_bar_again_selects_its_query_unless_a_composition_runs: request taken {taken} has_focus {} field {:?} egui focused {:?}",
edit.response.has_focus(),
edit.response.id,
ui.ctx().memory(|memory| memory.focused())
);
focus::request(ui.ctx(), FocusTarget::Id(edit.response.id));
// Asking again each run until the field holds focus keeps the request across the measuring run.
if edit.response.has_focus()
// The field's focus sits on its text part, so the egui response of the field never reports it.
if focus::is_focused(ui.ctx(), edit.response.id)
&& let Some(state) = state.as_deref_mut()
{
state.served();
-5
View File
@@ -43,11 +43,6 @@ impl Bar {
self.discard.set(rerun);
self.state.borrow_mut().open();
self.fixture.frame(Vec::new()).settle();
eprintln!(
"DIAG asking_for_the_bar_again_selects_its_query_unless_a_composition_runs: rerun {rerun} opening {} focused {:?}",
self.state.borrow().is_opening(),
self.fixture.focused()
);
assert!(!self.state.borrow().is_opening(), "the query field took the focus request");
}
+1 -1
View File
@@ -622,7 +622,7 @@ pub(crate) fn is_row_child(ctx: &Context, stop: &Stop) -> bool {
/// Whether the focus stop is the component `id`: the focused member or item of its arena, or a root that
/// holds focus while none of its members is the stop. A root's own focused part counts as the root.
pub(crate) fn is_focused(ctx: &Context, id: Id) -> bool {
pub fn is_focused(ctx: &Context, id: Id) -> bool {
focused_stop(ctx).is_some_and(|(focused, _)| focused == id)
}
+2 -1
View File
@@ -146,7 +146,8 @@ impl Lists<'_> {
fn arrival(&self, group: &super::Group) -> Option<StopRec> {
let mut group = *group;
for _ in 0..MAX_NESTING {
let selected = group.selected.and_then(|key| self.stops.iter().find(|rec| rec.stop.key() == key && self.slot_in(rec, group.id).is_some()));
let selected =
group.selected.and_then(|key| self.stops.iter().find(|rec| rec.stop.key() == key && self.slot_in(rec, group.id).is_some()));
if let Some(rec) = selected {
return Some(rec.clone());
}
@@ -141,10 +141,6 @@ fn text_size_from(story: &Story, base: Shot) -> Result<(), String> {
// A run the component painted elided is shortened by design and keeps its full text in the access name
// (the elision rule checks that), so it is not cut; it must still stay inside its part.
if !grown.keeps(same.rect, same.clip) {
eprintln!(
"DIAG {}: variant {name} base run {:?} clip {:?} grown run {:?} clip {:?} elided {} shown {:?}",
story.name, run.rect, run.clip, same.rect, same.clip, same.elided, grown.shown
);
return Err(format!("{}: under {name} the text `{}` leaves its part", story.name, run.text));
}
}