From 41f2554eae34e71efca8b0fc7642d60b53306aad Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 30 Nov 2026 01:51:18 -0800 Subject: [PATCH] Info: a click on a readout copies it again inside a measured flyout At the craft-libs pin this branch moves to, a panel shown in a dock flyout runs its body twice in the release frame: first in the container's invisible sizing pass, then in the real run. copy_shown read the release in the sizing pass, where the readout has no area, and cleared the press it had remembered, so the real run saw a release without a press and copied nothing. Info's W, H and other readouts stopped copying (panel_readout_copy: three tests failed with no copy). copy_shown now returns before reading input or the remembered press in a sizing pass. --- crates/ui-egui/src/panels/doc_info.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/ui-egui/src/panels/doc_info.rs b/crates/ui-egui/src/panels/doc_info.rs index e6f7cb6e86..5cb45f666a 100644 --- a/crates/ui-egui/src/panels/doc_info.rs +++ b/crates/ui-egui/src/panels/doc_info.rs @@ -59,6 +59,12 @@ pub(crate) fn copy_value(ui: &mut Ui, label: &str, value: &str, mono: bool) -> b /// The same guarded full-value copy for an already shown readout. An elided path remains /// static text: selection indices must describe the text actually shown by the framework. pub(crate) fn copy_shown(ui: &mut Ui, shown: &egui::Response, value: &str) -> bool { + // A container's measuring run shows the readout in an invisible sizing pass before the frame's real run, with the + // same id and the same input. It neither copies nor reads or clears the remembered press: clearing it there would + // leave the real run's release without its press. + if ui.is_sizing_pass() { + return false; + } // The click's own position and keys: a move or a key change after the release in the same // frame leaves the pointer and the held keys elsewhere. A frame with more than one release // copies nothing, since the click flags below do not say which release they describe.