From 5627d2b6bf2bba98afd7dcd7376cfe6aa1837471 Mon Sep 17 00:00:00 2001 From: TheRenegadeDev Date: Fri, 16 Oct 2026 20:35:01 -0500 Subject: [PATCH] Prefill the Remove Duplicates range from the selection (#1388) --- crates/ui-egui/src/dialogs.rs | 22 ++++++++++++++++++++-- docs/ui-parity.md | 3 ++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index fb899c702..f19babf66 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -434,8 +434,12 @@ impl Dialog { "removeDuplicates", "Remove Duplicates", "data.removeDuplicates", - vec![Check { key: "header", label: "My data has headers" }, Text { key: "columnsText", label: "Columns (blank = all, e.g. A,C):" }], - json!({"header": true}), + vec![ + Text { key: "range", label: "Range:" }, + Check { key: "header", label: "My data has headers" }, + Text { key: "columnsText", label: "Columns (blank = all, e.g. A,C):" }, + ], + json!({"range": sel, "header": true}), ), "goalSeek" => Dialog::custom("goalSeek", "Goal Seek", json!({"set": active, "to": "0", "changing": ""})), "forecastSheet" => Dialog::form( @@ -2711,6 +2715,20 @@ mod data_validation_tests { mod tests { use super::*; + #[test] + fn remove_duplicates_prefills_the_selection_and_submits_the_edited_range() { + let mut session = gridcraft_engine::Session::default(); + session.new_workbook(); + session.execute("selection.set", json!({"range": "B2:C5"})).unwrap(); + let mut app = SheetApp::new(session, Default::default()); + let mut dialog = Dialog::open(&mut app, "removeDuplicates", json!({})).unwrap(); + assert_eq!(dialog.values.get("range"), Some(&json!("B2:C5"))); + assert!(dialog.fields.iter().any(|field| matches!(field, Field::Text { key: "range", .. }))); + assert_eq!(build_params(&dialog)["range"], "B2:C5"); + dialog.set_value("range", json!("D2:E6")); + assert_eq!(build_params(&dialog)["range"], "D2:E6"); + } + #[test] fn data_validation_opens_on_the_rule_of_the_active_cell() { let mut session = gridcraft_engine::Session::default(); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 22e221e69..7af015a9c 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (horizontal scrollbar in the sheet tab bar, #840) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-16 · **Change:** minor (Remove Duplicates range prefill, #1388) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Interaction, controls and feel, against Excel. Part of [target-app-parity.md](target-app-parity.md). **UI/UX fidelity: ~55% ready, 50–80 h** (estimated). Ribbon command coverage is measured @@ -161,6 +161,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. | Date | Change | Summary | |---|---|---| +| 2026-10-16 | minor | Remove Duplicates shows an editable Range field initialized from the selection and passes it to the engine on OK (#1388). Live range-picking outside the dialog remains unsupported | | 2026-10-12 | minor | The File view's recent list tells when each workbook was last changed, read off the UI thread | | 2026-10-13 | minor | Horizontal scrollbar in the sheet tab bar: drag, track click pages, frozen columns excluded from the page (#840) | | 2026-10-12 | minor | Ctrl+wheel zoom steps along a ladder of percentages about 20% apart that never skips 100%, gliding to each step with animations on, so a notch out undoes a notch in (it drifted: 100 → 122 → 101); Excel steps 15 points, see decisions.md |