From bd52c643ca8ca694008d274ef177c343ed61aed2 Mon Sep 17 00:00:00 2001 From: FredApps Date: Thu, 29 Oct 2026 06:51:52 +0100 Subject: [PATCH] Wire JXL codec import and preserve destination-tab path tracking after owned commit --- crates/codecs/src/lib.rs | 2 +- crates/ui-egui/src/pen_path_ownership_tests.rs | 4 ++++ crates/ui-egui/src/tools/vector_ui.rs | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/codecs/src/lib.rs b/crates/codecs/src/lib.rs index c49daa61a3..be725ef043 100644 --- a/crates/codecs/src/lib.rs +++ b/crates/codecs/src/lib.rs @@ -48,7 +48,7 @@ pub use crate::resolution::{exif_resolution, export_exif, export_xmp, photoshop_ pub use crate::source_settings::{WebpEncoding, jpeg_quality, webp_encoding}; pub use half::f16; -use crate::codecs::{dds, dicom, dpx, exr, fits, heif, iff, jpeg, pcx, png, pnm, tiff, via_image, webp, xpm}; +use crate::codecs::{dds, dicom, dpx, exr, fits, heif, iff, jpeg, jxl, pcx, png, pnm, tiff, via_image, webp, xpm}; /// Detect the format and decode with default [`Limits`]. pub fn decode(bytes: &[u8]) -> Result { diff --git a/crates/ui-egui/src/pen_path_ownership_tests.rs b/crates/ui-egui/src/pen_path_ownership_tests.rs index 1a592d3e5a..388637b488 100644 --- a/crates/ui-egui/src/pen_path_ownership_tests.rs +++ b/crates/ui-egui/src/pen_path_ownership_tests.rs @@ -442,9 +442,13 @@ fn tab_switch_commits_only_the_valid_original_captured_saved_path() { draft(&mut app); let source = app.session.active().unwrap().doc.id; app.session.execute("file.new", json!({"width":200,"height":200})).unwrap(); + seed(&mut app, "Destination", 100.0); + app.ui.selected_path = Some("Destination".into()); let current = app.session.active().unwrap().doc.clone(); assert!(vector_ui::cancel_stale_pen(&mut app)); assert!(app.ui.pen.is_none()); + app.sync_views(); + assert_eq!(app.ui.selected_path.as_deref(), Some("Destination")); assert!(std::sync::Arc::ptr_eq(¤t, &app.session.active().unwrap().doc)); let old = app.session.documents().iter().find(|s| s.doc.id == source).unwrap(); assert_eq!(old.doc.paths.iter().find(|p| p.name == "Saved drawing").unwrap().path.subpaths.len(), 2); diff --git a/crates/ui-egui/src/tools/vector_ui.rs b/crates/ui-egui/src/tools/vector_ui.rs index 0fd501ad18..c2653b44b3 100644 --- a/crates/ui-egui/src/tools/vector_ui.rs +++ b/crates/ui-egui/src/tools/vector_ui.rs @@ -249,6 +249,10 @@ pub(crate) fn cancel_stale_pen(app: &mut PhotocraftApp) -> bool { } let failed = app.ui.pen.take(); let message = app.ui.status.clone(); + // The temporary source commit ran sync_views on that document. Rebind its runtime + // tracker before restoring the destination UI, so the next frame cannot clear + // an unrelated saved-path selection in the destination tab. + app.path_document = app.session.active().map(|st| (st.doc.id, st.revision, Arc::downgrade(&st.doc))); app.ui = saved_ui; app.ui.pen = if result.is_ok() { None } else { failed }; if result.is_err() {