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.
This commit is contained in:
dotCooCoo committed 2026-11-30 01:51:18 -08:00
1 parent d8e090f51f
commit 41f2554eae
1 file changed
+6
+6
View File
@@ -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.