From 0427d52cbb5d445dfefb1d0d286bfb653c07d475 Mon Sep 17 00:00:00 2001 From: David Mann Date: Wed, 21 Oct 2026 12:17:13 +0200 Subject: [PATCH] Fix up the merges of #3535, #3567 and #6088: one catalog line per string, purge test as in #3567 The merges left the History Options and New Snapshot strings twice in the hu, sr, tr and vi catalogs (this branch's old copies next to #3535's and #3567's), which the catalog consistency test refuses; the owners' lines stay. The purge-histories test had both #3567's and this branch's edits; it is #3567's again. A test checks the snapshots against #3535's current visibility rule: with visibility changes not undoable, undoing the selection of the first snapshot or a save snapshot hides a layer the eye hid again, and Redo shows it. Regenerated docs/scorecard.md. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/history_cmds.rs | 3 --- crates/engine/src/history_options_cmds.rs | 27 +++++++++++++++++++++++ crates/ui-egui/src/i18n/hu.tsv | 5 ----- crates/ui-egui/src/i18n/sr.tsv | 3 --- crates/ui-egui/src/i18n/tr.tsv | 5 ----- crates/ui-egui/src/i18n/vi.tsv | 3 --- docs/scorecard.md | 4 ++-- 7 files changed, 29 insertions(+), 21 deletions(-) diff --git a/crates/engine/src/history_cmds.rs b/crates/engine/src/history_cmds.rs index 2242ce98d0..4c352ad4b9 100644 --- a/crates/engine/src/history_cmds.rs +++ b/crates/engine/src/history_cmds.rs @@ -516,9 +516,6 @@ mod tests { #[test] fn purging_histories_frees_only_what_no_snapshot_keeps() { let mut s = session(); - // Only the snapshot taken here: the first snapshot (the document as opened) would keep - // tiles of the oldest states too. - s.execute("history.deleteSnapshot", json!({"snapshot": 0})).unwrap(); s.execute("history.newSnapshot", json!({})).unwrap(); s.execute("edit.fill", json!({"color": "#0000ff"})).unwrap(); let st = s.active().unwrap(); diff --git a/crates/engine/src/history_options_cmds.rs b/crates/engine/src/history_options_cmds.rs index 60f97098b4..5f04c55888 100644 --- a/crates/engine/src/history_options_cmds.rs +++ b/crates/engine/src/history_options_cmds.rs @@ -553,6 +553,33 @@ mod tests { assert_eq!(crate::inspect::session(&s)["historyOptions"]["showNewSnapshotDialogByDefault"], json!(true)); } + /// The first snapshot and a save snapshot are recorded steps like any other: with Make Layer + /// Visibility Changes Undoable off, selecting one that shows a layer the eye hid, then Undo, + /// hides the layer again, and Redo shows it (the step changed it, #3535's rule). + #[test] + fn selecting_a_snapshot_undoes_its_own_visibility_change() { + let mut s = Session::new(); + s.execute("file.new", json!({"width": 16, "height": 16})).unwrap(); + let id = s.active().unwrap().active_layer.unwrap().0; + // Red, not the white document as opened (`red` only reads the red channel). + let red = |s: &Session| s.active().unwrap().doc.layer(photocraft_doc::LayerId(id)).unwrap().surface().unwrap().pixel(1, 1)[1] < 0.5; + s.execute(CMD, json!({"makeLayerVisibilityChangesUndoable": false, "automaticallyCreateNewSnapshotWhenSaving": true})).unwrap(); + s.execute("edit.fill", json!({"color": "#ff0000"})).unwrap(); + s.active_mut().unwrap().saved_to("saved.psd".into()); + let saved = snapshot_on_save(&mut s).unwrap(); + // The eye hides the layer: no state. + s.execute("layer.setProps", json!({"layer": id, "visible": false})).unwrap(); + for (snap, is_red) in [(0, false), (saved, true)] { + s.execute("history.selectSnapshot", json!({"snapshot": snap})).unwrap(); + assert!(visible(&s, id) && red(&s) == is_red, "snapshot {snap} shows the layer as it was"); + s.execute("edit.undo", json!({})).unwrap(); + assert!(!visible(&s, id) && red(&s), "undoing snapshot {snap} hides the layer again"); + s.execute("edit.redo", json!({})).unwrap(); + assert!(visible(&s, id) && red(&s) == is_red, "redoing snapshot {snap} shows it"); + s.execute("edit.undo", json!({})).unwrap(); + } + } + /// With the oldest state current, non-linear Delete is still enabled for a later (dimmed) /// state (the History panel's trash and its drop target ask for it); linear history has /// nothing to delete there. diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0825e7c7c9..4f2b0c5eb4 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3702,12 +3702,7 @@ cameraRaw Yellow Sárga Auto-leading % Automatikus sorköz % Automatically Create First Snapshot Első pillanatkép automatikus létrehozása Automatically Create New Snapshot When Saving Új pillanatkép automatikus létrehozása mentéskor - From: Forrás: - Full Document Teljes dokumentum - Merged Layers Egyesített rétegek History Options… Előzménybeállítások… - Allow Non-Linear History Nemlineáris előzmények engedélyezése - Make Layer Visibility Changes Undoable A rétegláthatóság módosításai visszavonhatók legyenek Avoid Widows/Orphans Fattyúsorok elkerülése Blend RGB Colors Using Gamma 1.0 RGB-színek keverése 1,0 gammával Blending Mode Keverési mód diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index 513dcd47bb..275d0a3ac0 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -2290,9 +2290,6 @@ History Options… Opcije istorije… Allow Non-Linear History Dozvoli nelinearnu istoriju Make Layer Visibility Changes Undoable Omogući opozivanje promena vidljivosti slojeva - From: Od: - Full Document Ceo dokument - Merged Layers Spojeni slojevi Panel Options… Opcije panela… View menu Meni prikaza Keep view in sync Drži prikaz usklađenim diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 84cd0aeec5..d045880b51 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -2697,12 +2697,7 @@ cameraRaw Color Renk Set New Snapshot as Default Yeni Anlık Görüntüyü Varsayılan Olarak Ayarla Automatically Create First Snapshot İlk Anlık Görüntüyü Otomatik Olarak Oluştur Automatically Create New Snapshot When Saving Kaydederken Otomatik Olarak Yeni Anlık Görüntü Oluştur - From: Kaynak: - Full Document Tam Belge - Merged Layers Birleştirilmiş Katmanlar History Options… Geçmiş Seçenekleri… - Allow Non-Linear History Doğrusal Olmayan Geçmişe İzin Ver - Make Layer Visibility Changes Undoable Katman Görünürlüğü Değişikliklerini Geri Alınabilir Yap Show New Snapshot Dialog by Default Yeni Anlık Görüntü İletişim Kutusunu Varsayılan Olarak Göster Clear History Geçmişi Temizle Panel Options… Panel Seçenekleri… diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 521ab4fdc3..4e919df810 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3670,9 +3670,6 @@ curves Smooth Làm mượt set in Print Settings… đặt trong thiết lập in… ICO is limited to 256 × 256 pixels ICO giới hạn ở 256 × 256 pixel # History panel › History Options… (#2966) - History Options… Tùy chọn lịch sử… - Allow Non-Linear History Cho phép lịch sử không tuyến tính - Make Layer Visibility Changes Undoable Cho phép hoàn tác thay đổi hiển thị lớp Automatically Create First Snapshot Tự động tạo ảnh chụp trạng thái đầu tiên Automatically Create New Snapshot When Saving Tự động tạo ảnh chụp trạng thái mới khi lưu Show New Snapshot Dialog by Default Mặc định hiện hộp thoại Ảnh chụp trạng thái mới diff --git a/docs/scorecard.md b/docs/scorecard.md index c26e0a8020..7707161883 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 | 25 | 59 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 20 not run, 5 not measurable yet (baseline 2026-10-05) | | [File compatibility](#file-compatibility) | 7 | 14 | 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) | 33 | 11 | 0 | | -| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 172 (target 0) | +| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 175 (target 0) | | [Type](#type) | 4 | 3 | 2 | | | [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 | @@ -180,7 +180,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t ## Workspace and UI -**Settings that do nothing: 26 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. +**Settings that do nothing: 26 of 175** (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.animated_zoom`, `general.zoom_resizes_windows`, `workspace.auto_show_hidden_panels`, `workspace.enable_floating_document_window_docking`, `file_handling.save_in_background`, `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`.