PhotoCraft: An open-source, photo editor written by scratch in pure Rust
fix(ui-egui): File Handling preference to not append "copy" when saving a copy, as in Photoshop (#8080)
Korg1ch5f4c636b092c
diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rsindex 419468426..c8184c86f 100644--- a/crates/engine/src/prefs.rs+++ b/crates/engine/src/prefs.rs@@ -444,6 +444,8 @@ impl Default for HistoryLog {pub struct FileHandling {pub image_previews: Ask,pub lowercase_extension: bool,+ /// File › Save a Copy suggests the document's own name rather than "<name> copy" (#8080).+ pub do_not_append_copy: bool,/// Saves run in the background while you keep working (on), or in the foreground under a/// modal progress dialog that blocks the app until the file is written (off).pub save_in_background: bool,@@ -467,11 +469,20 @@ pub struct FileHandling {pub recent_files: Vec<String>,}+impl FileHandling {+ /// What File › Save a Copy appends to the document's name: " copy", or nothing with Do not+ /// append "copy" to filename when saving a copy (#8080).+ pub fn copy_suffix(&self) -> &'static str {+ if self.do_not_append_copy { "" } else { " copy" }+ }+}+impl Default for FileHandling {fn default() -> Self {Self {image_previews: Ask::Always,lowercase_extension: true,+ do_not_append_copy: false,save_in_background: true,autosave: true,autosave_minutes: 10,diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex 9f3ca51dd..992a440c0 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -3808,6 +3808,7 @@ navigator Zoom ZvětšeníChisel Hard Tvrdé tesáníChisel Soft Měkké tesáníOpen color-less EXR as ACEScg Otevřít EXR bez údaje o barevném prostoru jako ACEScg+ Do not append "copy" to filename when saving a copy Nepřidávat „copy“ k názvu souboru při ukládání kopie# View › Guides › right-click a guideEdit Selected Guides Upravit vybraná vodítkadiff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsvindex c4c03454e..64cab1b86 100644--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -3203,6 +3203,7 @@ curves Smooth GlättenChisel Hard Meißeln hartChisel Soft Meißeln weichOpen color-less EXR as ACEScg Farbangabenloses EXR als ACEScg öffnen+ Do not append "copy" to filename when saving a copy Beim Speichern einer Kopie „copy“ nicht an den Dateinamen anhängen# Export As metadata and profile optionsColor Profile FarbprofilEXIF EXIFdiff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsvindex 74ab59cba..48c6684db 100644--- a/crates/ui-egui/src/i18n/el.tsv+++ b/crates/ui-egui/src/i18n/el.tsv@@ -3896,6 +3896,7 @@ curves Smooth ΕξομάλυνσηChisel Hard Σκληρή σμίλευσηChisel Soft Μαλακή σμίλευσηOpen color-less EXR as ACEScg Άνοιγμα EXR χωρίς χρωματική δήλωση ως ACEScg+ Do not append "copy" to filename when saving a copy Να μην προστίθεται «copy» στο όνομα αρχείου κατά την αποθήκευση αντιγράφου# Export As metadata and profile optionsEXIF EXIFdiff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex cbbbbc14f..3ad60013f 100644--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -4159,6 +4159,7 @@ navigator Zoom ZoomChisel Hard Cincelar duroChisel Soft Cincelar suaveOpen color-less EXR as ACEScg Abrir EXR sin espacio de color como ACEScg+ Do not append "copy" to filename when saving a copy No añadir «copy» al nombre de archivo al guardar una copia# Export As metadata and profile options# View › Guides › right-click a guidediff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsvindex e8164e967..3fd3d4b30 100644--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@ -3204,6 +3204,7 @@ curves Smooth LisserChisel Hard Ciselage durChisel Soft Ciselage douxOpen color-less EXR as ACEScg Ouvrir les EXR sans espace colorimétrique en ACEScg+ Do not append "copy" to filename when saving a copy Ne pas ajouter « copy » au nom de fichier lors de l’enregistrement d’une copie# View › Guides › right-click a guideEdit Selected Guides Modifier les repères sélectionnésdiff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsvindex fe21a5fbf..b2548d766 100644--- a/crates/ui-egui/src/i18n/hu.tsv+++ b/crates/ui-egui/src/i18n/hu.tsv@@ -4114,6 +4114,7 @@ cameraRaw Yellow SárgaChisel Hard Kemény vésésChisel Soft Lágy vésésOpen color-less EXR as ACEScg Színinformáció nélküli EXR megnyitása ACEScg-ként+ Do not append "copy" to filename when saving a copy Ne fűzze a „copy” szót a fájlnévhez másolat mentésekor# View › Guides › right-click a guideEdit Selected Guides Kijelölt segédvonalak szerkesztésediff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsvindex 0feaf2839..9b627965e 100644--- a/crates/ui-egui/src/i18n/id.tsv+++ b/crates/ui-egui/src/i18n/id.tsv@@ -3191,6 +3191,7 @@ curves Smooth HaluskanChisel Hard Pahat KerasChisel Soft Pahat LembutOpen color-less EXR as ACEScg Buka EXR tanpa informasi warna sebagai ACEScg+ Do not append "copy" to filename when saving a copy Jangan tambahkan "copy" ke nama file saat menyimpan salinan# View › Guides › right-click a guideEdit Selected Guides Edit Panduan Terpilihdiff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsvindex 57b58861a..239637693 100644--- a/crates/ui-egui/src/i18n/it.tsv+++ b/crates/ui-egui/src/i18n/it.tsv@@ -4161,6 +4161,7 @@ navigator Zoom ZoomChisel Hard Cesello duroChisel Soft Cesello morbidoOpen color-less EXR as ACEScg Apri gli EXR senza spazio colore come ACEScg+ Do not append "copy" to filename when saving a copy Non aggiungere "copy" al nome del file quando si salva una copia# Color management, Liquify, glyph group, warp and Camera Raw labels the Serbian, Vietnamese and Japanese catalogs addedAdobe-rgb-compat Adobe RGB (compatibile)diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsvindex 28fe0ccc6..84fa99d18 100644--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@ -3875,6 +3875,7 @@ curves Smooth スムーズChisel Hard チゼルハードChisel Soft チゼルソフトOpen color-less EXR as ACEScg 色空間のないEXRをACEScgとして開く+ Do not append "copy" to filename when saving a copy コピーを保存するときにファイル名に「copy」を付けない# View › Guides › right-click a guideEdit Selected Guides 選択したガイドを編集Clear Selected Guides 選択したガイドを消去diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsvindex e9163eba8..14f94f29d 100644--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@ -3379,6 +3379,7 @@ curves Smooth 매끄럽게Chisel Hard 단단하게 조각Chisel Soft 부드럽게 조각Open color-less EXR as ACEScg 색 공간 정보 없는 EXR을 ACEScg로 열기+ Do not append "copy" to filename when saving a copy 사본 저장 시 파일 이름에 "copy"를 붙이지 않음# Export As metadata and profile optionsColor Profile 색상 프로필EXIF EXIFdiff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsvindex 9b20a49de..06bf2bac8 100644--- a/crates/ui-egui/src/i18n/nl.tsv+++ b/crates/ui-egui/src/i18n/nl.tsv@@ -3958,6 +3958,7 @@ curves Smooth Vloeiend makenChisel Hard Beitel hardChisel Soft Beitel zachtOpen color-less EXR as ACEScg EXR zonder kleurruimte als ACEScg openen+ Do not append "copy" to filename when saving a copy Geen "copy" aan de bestandsnaam toevoegen bij het opslaan van een kopie# View › Guides › right-click a guideEdit Selected Guides Geselecteerde hulplijnen bewerkendiff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsvindex b223c0cd2..62a32ebc1 100644--- a/crates/ui-egui/src/i18n/pl.tsv+++ b/crates/ui-egui/src/i18n/pl.tsv@@ -3796,6 +3796,7 @@ curves Smooth WygładźChisel Hard Dłuto twardeChisel Soft Dłuto miękkieOpen color-less EXR as ACEScg Otwieraj EXR bez profilu koloru jako ACEScg+ Do not append "copy" to filename when saving a copy Nie dodawaj „copy” do nazwy pliku przy zapisywaniu kopii# View › Guides › right-click a guideEdit Selected Guides Edytuj zaznaczone prowadnicediff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsvindex 5319f4f74..8b685531c 100644--- a/crates/ui-egui/src/i18n/pt-br.tsv+++ b/crates/ui-egui/src/i18n/pt-br.tsv@@ -3988,6 +3988,7 @@ layerLabel No Color Sem corChisel Hard Cinzel duroChisel Soft Cinzel suaveOpen color-less EXR as ACEScg Abrir EXR sem espaço de cor como ACEScg+ Do not append "copy" to filename when saving a copy Não acrescentar "copy" ao nome do arquivo ao salvar uma cópia# View › Guides › right-click a guideEdit Selected Guides Editar guias selecionadasdiff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex fb0af355c..1c2209dde 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -3169,6 +3169,7 @@ curves Smooth СгладитьChisel Hard Жесткая огранкаChisel Soft Мягкая огранкаOpen color-less EXR as ACEScg Открывать EXR без цветового профиля как ACEScg+ Do not append "copy" to filename when saving a copy Не добавлять «copy» к имени файла при сохранении копии# View › Guides › right-click a guideEdit Selected Guides Изменить выбранные направляющиеdiff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsvindex 2b02f33bc..d69968720 100644--- a/crates/ui-egui/src/i18n/sr.tsv+++ b/crates/ui-egui/src/i18n/sr.tsv@@ -4267,6 +4267,7 @@ shape Appearance IzgledChisel Hard Tvrdo klesanjeChisel Soft Meko klesanjeOpen color-less EXR as ACEScg Otvori EXR bez podatka o bojama kao ACEScg+ Do not append "copy" to filename when saving a copy Ne dodaji „copy“ u ime fajla pri čuvanju kopijeShow home recent files Prikaži nedavne datoteke na početnom ekranu# View › Guides › right-click a guidediff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsvindex d3f6faf4a..b8411a78f 100644--- a/crates/ui-egui/src/i18n/tr.tsv+++ b/crates/ui-egui/src/i18n/tr.tsv@@ -3925,6 +3925,7 @@ cameraData Lens LensChisel Hard Sert KeskiChisel Soft Yumuşak KeskiOpen color-less EXR as ACEScg Renk bilgisi olmayan EXR'yi ACEScg olarak aç+ Do not append "copy" to filename when saving a copy Kopya kaydederken dosya adına "copy" ekleme# View › Guides › right-click a guideEdit Selected Guides Seçili Kılavuzları Düzenlediff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsvindex bc5e98c2a..30c529770 100644--- a/crates/ui-egui/src/i18n/uk.tsv+++ b/crates/ui-egui/src/i18n/uk.tsv@@ -3897,6 +3897,7 @@ curves Smooth ЗгладитиChisel Hard Жорстке різьбленняChisel Soft М'яке різьбленняOpen color-less EXR as ACEScg Відкривати EXR без колірного профілю як ACEScg+ Do not append "copy" to filename when saving a copy Не додавати «copy» до імені файлу під час збереження копії# View › Guides › right-click a guideEdit Selected Guides Редагувати вибрані напрямніdiff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsvindex efba5ce8c..2c84a07af 100644--- a/crates/ui-egui/src/i18n/vi.tsv+++ b/crates/ui-egui/src/i18n/vi.tsv@@ -3685,6 +3685,7 @@ curves Smooth Làm mượtChisel Hard Đục cứngChisel Soft Đục mềmOpen color-less EXR as ACEScg Mở EXR không khai báo màu sắc dưới dạng ACEScg+ Do not append "copy" to filename when saving a copy Không thêm "copy" vào tên tệp khi lưu bản sao# View › Guides › right-click a guideEdit Selected Guides Sửa đường căn đã chọndiff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex f5f2aa37b..401a14a07 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -2820,6 +2820,7 @@ curves Smooth 平滑Chisel Hard 雕刻清晰Chisel Soft 雕刻柔和Open color-less EXR as ACEScg 将无色彩空间信息的 EXR 以 ACEScg 打开+ Do not append "copy" to filename when saving a copy 存储副本时不在文件名后添加“copy”# Export As metadata and profile optionsColor Profile 颜色配置文件EXIF EXIFdiff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex 0e81f6b4f..8e2df33c9 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -2805,6 +2805,7 @@ curves Smooth 平滑Chisel Hard 雕刻清晰Chisel Soft 雕刻柔和Open color-less EXR as ACEScg 將無色彩空間資訊的 EXR 以 ACEScg 開啟+ Do not append "copy" to filename when saving a copy 儲存副本時不在檔名後加上「copy」# Export As metadata and profile optionsColor Profile 色彩描述檔EXIF EXIFdiff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rsindex f699bce37..bbe6eff6b 100644--- a/crates/ui-egui/src/prefs_ui.rs+++ b/crates/ui-egui/src/prefs_ui.rs@@ -1159,6 +1159,10 @@ fn humanize(key: &str) -> String {}// Performance: presentation without vsync (#1343); like the other graphics settings, it// takes effect when the window next opens.+ // File Handling: Photoshop's wording (#8080).+ if key == "doNotAppendCopy" {+ return "Do not append \"copy\" to filename when saving a copy".into();+ }if key == "lowLatencyDrawing" {return "Low-Latency Drawing (vsync off, applies at next launch)".into();}diff --git a/crates/ui-egui/src/view_cmds.rs b/crates/ui-egui/src/view_cmds.rsindex 7fffcf784..611c3a5c1 100644--- a/crates/ui-egui/src/view_cmds.rs+++ b/crates/ui-egui/src/view_cmds.rs@@ -1471,7 +1471,10 @@ fn front(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: &Value)fn save_a_copy(app: &mut PhotocraftApp) -> Result<Value, String> {let doc = app.session.active().ok_or("no document")?.doc.clone();let stem = doc.name.rsplit_once('.').map_or(doc.name.as_str(), |(a, _)| a);- let suggested = format!("{stem} copy.psd");+ // "<name> copy.psd", or with Preferences › File Handling › Do not append "copy" to filename+ // when saving a copy the document's own name (only the extension may change), as in+ // Photoshop (#8080).+ let suggested = format!("{stem}{}.psd", app.session.prefs().file_handling.copy_suffix());// The copy is of the document as it was when asked.app.pick_save(&suggested, move |app, path| {// An RGB Targa asks for its bits per pixel first, and a DDS texture for its compression;diff --git a/docs/scorecard.md b/docs/scorecard.mdindex 5a59aad2a..e059220a6 100644--- a/docs/scorecard.md+++ b/docs/scorecard.md@@ -9,7 +9,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js| [Performance](#performance) | 3 | 22 | 26 | 60 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 22 not run, 4 not measurable yet (baseline 2026-10-05) || [File compatibility](#file-compatibility) | 9 | 12 | 6 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 188/256, round trip ≥ 258/256 || [Tools](#tools) | 36 | 8 | 0 | |-| [Workspace and UI](#workspace-and-ui) | 13 | 7 | 3 | settings that do nothing: 24 of 171 (target 0) |+| [Workspace and UI](#workspace-and-ui) | 13 | 7 | 3 | settings that do nothing: 24 of 172 (target 0) || [Type](#type) | 5 | 3 | 1 | || [Automation](#automation) | 5 | 2 | 4 | 631 of 631 menu items live (100.0%) || [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 30 of 30 crates; panic_hunt present |@@ -181,7 +181,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t## Workspace and UI-**Settings that do nothing: 24 of 171** (target 0, #204). Counted by the prefs audit (`xtask/src/scorecard.rs`): a `Preferences` field counts as read when code outside the prefs model (`prefs.rs` except its `impl Session` blocks; tests excluded; the schema-driven dialog never names a field) accesses `section.field`, or `.section` and `.field` in the same file, or calls a section method that reads `self.field`. It is a heuristic lower bound: a generic name can look read when it isn't.+**Settings that do nothing: 24 of 172** (target 0, #204). Counted by the prefs audit (`xtask/src/scorecard.rs`): a `Preferences` field counts as read when code outside the prefs model (`prefs.rs` except its `impl Session` blocks; tests excluded; the schema-driven dialog never names a field) accesses `section.field`, or `.section` and `.field` in the same file, or calls a section method that reads `self.field`. It is a heuristic lower bound: a generic name can look read when it isn't.Unread: `general.color_picker`, `general.zoom_resizes_windows`, `workspace.auto_show_hidden_panels`, `workspace.enable_floating_document_window_docking`, `performance.cache_levels`, `performance.gpu_adapter`, `performance.legacy_compositing`, `scratch_disks.disks`, `units_and_rulers.column_width`, `units_and_rulers.gutter`, `plug_ins.show_extension_panels`, `plug_ins.allow_scripts_to_connect`, `plug_ins.generator_enabled`, `type_.text_engine`, `type_.recent_fonts`, `enhanced_controls.scrubby_slider_acceleration`, `raw_defaults.color_space`, `raw_defaults.bit_depth`, `raw_defaults.resolution`, `raw_defaults.sharpen_for`, `raw_defaults.open_as_smart_object`, `raw_defaults.apply_auto_tone`, `integrations.allow_agent_control`, `integrations.control_port`.