From 3d27feac180f04bdcbcf08d93d3b821cbd2a08e9 Mon Sep 17 00:00:00 2001 From: Higgs32584 Date: Mon, 19 Oct 2026 21:45:07 -0400 Subject: [PATCH] Save: a plain Save records its Targa answer too save_in_place_with journalled only the JPEG answer, so a replayed or scripted file.save with tgaBits replayed at the default bits (CodeRabbit on #7878). Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/file_dialog/tests.rs | 9 +++++++++ crates/ui-egui/src/lib.rs | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/file_dialog/tests.rs b/crates/ui-egui/src/file_dialog/tests.rs index 1237c518bc0..b3b44c731e2 100644 --- a/crates/ui-egui/src/file_dialog/tests.rs +++ b/crates/ui-egui/src/file_dialog/tests.rs @@ -1201,6 +1201,15 @@ fn save_of_a_flat_file_asks_after_the_dialog_when_another_app_changed_it() { assert_eq!(app.session.journal.last(), Some(&("file.save".to_string(), json!({}))), "still recorded as a plain Save"); } +/// A replayed plain Save keeps its Targa answer in the step it records, as well as its JPEG one. +#[test] +fn a_replayed_plain_save_records_its_targa_answer() { + let (mut app, _, written) = jpeg_app(Some("/pics/photo.tga"), false); + app.replay_save("file.save", &json!({"tgaBits": 24})).unwrap(); + assert_eq!(*written.borrow(), ["/pics/photo.tga"]); + assert_eq!(app.session.journal.last(), Some(&("file.save".to_string(), json!({"tgaBits": 24})))); +} + /// A script's JPEG Options answer survives the changed-on-disk prompt: Replace writes with it, /// without asking JPEG Options. #[test] diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 5f69a23f953..ad5a147c881 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -1601,7 +1601,11 @@ impl PhotocraftApp { return Err(SAVE_OPTIONS_OPEN.into()); } let r = self.write_save(path, None, choices)?; - self.session.journal.push(("file.save".into(), jpeg_options_ui::plain_save_step(choices.jpeg))); + let mut step = jpeg_options_ui::plain_save_step(choices.jpeg); + if let Some(bits) = choices.tga_bits { + step["tgaBits"] = bits.bits().into(); + } + self.session.journal.push(("file.save".into(), step)); Ok(r) }