From 411fd67c052925293e4db1ff9df9c2944ebaaefc Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Wed, 18 Nov 2026 21:36:08 +0000 Subject: [PATCH] rr-ribbon-w1: red round 2 (lead commit) --- crates/ui-contract/src/style/cx.rs | 10 +++++++++- crates/ui-widgets/src/tabs/strip.rs | 22 +++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/crates/ui-contract/src/style/cx.rs b/crates/ui-contract/src/style/cx.rs index 75b818ee6..8daa0c3fa 100644 --- a/crates/ui-contract/src/style/cx.rs +++ b/crates/ui-contract/src/style/cx.rs @@ -226,7 +226,15 @@ impl<'a> StyleCx<'a> { pub fn exiting(&self, name: &'static str, spec: MotionSpec, listed: &[impl Hash]) -> Vec<(Presence, P)> { let Some((id, policy)) = self.owner else { return Vec::new() }; let listed: Vec = listed.iter().map(crate::runtime::motion::key_id).collect(); - crate::runtime::motion::peek_exiting(self.ctx, id, policy, name, spec, &listed) + let out = crate::runtime::motion::peek_exiting(self.ctx, id, policy, name, spec, &listed); + eprintln!( + "DIAG a_contextual_tab_that_leaves_is_not_hit_or_listed_while_it_fades: style exiting owner={id:?} pass={} measuring={} listed={} out={:?}", + self.ctx.current_pass_index(), + crate::runtime::measure::active(self.ctx), + listed.len(), + out.iter().map(|(presence, _)| presence.t).collect::>() + ); + out } /// The same context with another variant. diff --git a/crates/ui-widgets/src/tabs/strip.rs b/crates/ui-widgets/src/tabs/strip.rs index f327f1026..8db77443d 100644 --- a/crates/ui-widgets/src/tabs/strip.rs +++ b/crates/ui-widgets/src/tabs/strip.rs @@ -643,6 +643,15 @@ impl<'a, K: Clone + Eq + Hash + Send + Sync + std::fmt::Debug + 'static> TabStri drop(texts); // The same keys in the same order as the layout reserved their slots from (`reserved`). self.ghosts = cx.exiting::(LEAVE, spec::OPEN_FADE).into_iter().map(|(presence, ghost)| Fading { label: ghost.label, alpha: presence.t }).collect(); + eprintln!( + "DIAG a_contextual_tab_that_leaves_is_not_hit_or_listed_while_it_fades: track id={:?} pass={} texts={} placed={:?} report_ghosts={:?} ghosts={:?}", + cx.core.id, + cx.core.ctx.current_pass_index(), + self.texts.borrow().len(), + report.placed, + report.ghosts, + self.ghosts + ); } /// The menus of the end items that open one, each below its item. @@ -687,13 +696,24 @@ impl<'a, K: Clone + Eq + Hash + Send + Sync + std::fmt::Debug + 'static> TabStri .iter() .enumerate() .filter_map(|(slot, (_, ghost))| Some(Reserved { slot, before: ghost.before.min(listed.len()), width: ghost.width? })) - .collect(); + .collect::>(); + eprintln!( + "DIAG a_contextual_tab_that_leaves_is_not_hit_or_listed_while_it_fades: reserved listed={} departing={:?} reserved={reserved:?}", + listed.len(), + departing.iter().map(|(presence, ghost)| (presence.t, ghost.before, ghost.width)).collect::>() + ); (reserved, departing.len()) } /// The departed contextual tabs at the slots the fit kept for them, each painted as the `Tab` it was, as opaque /// as its presence has left it. fn paint_ghosts(&self, ui: &mut PaintUi<'_>, report: &Report) { + if self.roles.is_some() { + eprintln!( + "DIAG a_contextual_tab_that_leaves_is_not_hit_or_listed_while_it_fades: paint ghosts={:?} report_ghosts={:?}", + self.ghosts, report.ghosts + ); + } for (at, fading) in self.ghosts.iter().enumerate() { if report.ghosts.get(at).copied().flatten().is_some() { let tab = Tab::new(fading.label.clone()).kind(TabKind::Ribbon).role(TabRole::Contextual);