mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-18 20:09:54 -06:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75db9af995 |
@@ -1,23 +1,8 @@
|
||||
use egui::Modifiers;
|
||||
|
||||
use super::show::ok_cancel;
|
||||
use super::{Dialog, Json, Key, SheetApp, json};
|
||||
|
||||
/// Draws the Find/Replace form with case, whole-cell and workbook options, requests field focus once, and runs find/replace with the current parameters.
|
||||
pub(super) fn find(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dialog) {
|
||||
// The dialog stays open over the sheet, so Undo and Redo reach the workbook (a Replace All
|
||||
// is undone without closing it first); inside a text box they edit the typed text instead.
|
||||
// A modal message blocks workbook shortcuts; otherwise use the grid's own shortcut table.
|
||||
if app.message.is_none() && !ui.ctx().text_edit_focused() {
|
||||
let pressed = ui.input_mut(|i| {
|
||||
[(Modifiers::COMMAND | Modifiers::SHIFT, Key::Z), (Modifiers::COMMAND, Key::Z), (Modifiers::COMMAND, Key::Y)]
|
||||
.into_iter()
|
||||
.find(|&(m, key)| i.consume_key(m, key))
|
||||
});
|
||||
if let Some((m, key)) = pressed {
|
||||
crate::ribbon::shortcut(app, key, m);
|
||||
}
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
for tab in ["Find", "Replace"] {
|
||||
if ui.selectable_label(d.tab == tab, tab).clicked() {
|
||||
|
||||
@@ -336,77 +336,6 @@ fn arrows_escape_and_undo() {
|
||||
assert_eq!(value(&h, "B2"), Value::Empty);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn undo_and_redo_reach_the_sheet_while_find_and_replace_is_open() {
|
||||
let mut h = harness(blank());
|
||||
for t in ["x1", "x2"] {
|
||||
text(&mut h, t);
|
||||
key(&mut h, Key::Enter, Modifiers::NONE);
|
||||
}
|
||||
h.state_mut().open_dialog("find", json!({"replace": true}));
|
||||
h.run_steps(3);
|
||||
if let Some(d) = h.state_mut().dialog.as_mut() {
|
||||
d.values.insert("what".into(), json!("x"));
|
||||
d.values.insert("with".into(), json!("y"));
|
||||
}
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Replace All").click();
|
||||
h.run_steps(3);
|
||||
assert_eq!((value(&h, "A1"), value(&h, "A2")), (Value::from("y1"), Value::from("y2")));
|
||||
// Keyboard focus on a button must not reserve Undo/Redo for text editing.
|
||||
h.get_by_label("Replace All").focus();
|
||||
h.run_steps(2);
|
||||
assert!(h.ctx.egui_wants_keyboard_input());
|
||||
assert!(!h.ctx.text_edit_focused());
|
||||
key(&mut h, Key::Z, Modifiers::COMMAND);
|
||||
assert!(h.state().dialog.is_some(), "the dialog stays open");
|
||||
assert_eq!((value(&h, "A1"), value(&h, "A2")), (Value::from("x1"), Value::from("x2")), "one Undo takes back the whole Replace All");
|
||||
key(&mut h, Key::Y, Modifiers::COMMAND);
|
||||
assert_eq!((value(&h, "A1"), value(&h, "A2")), (Value::from("y1"), Value::from("y2")));
|
||||
// The Mac Redo shortcut works too, as it does on the sheet.
|
||||
key(&mut h, Key::Z, Modifiers::COMMAND);
|
||||
assert_eq!(value(&h, "A1"), Value::from("x1"));
|
||||
key(&mut h, Key::Z, Modifiers::COMMAND | Modifiers::SHIFT);
|
||||
assert_eq!((value(&h, "A1"), value(&h, "A2")), (Value::from("y1"), Value::from("y2")));
|
||||
assert!(h.state().dialog.is_some(), "the dialog is still open");
|
||||
h.get_by_label("Find what:").focus();
|
||||
h.run_steps(2);
|
||||
assert!(h.ctx.text_edit_focused());
|
||||
let before = h.state().dialog.as_ref().unwrap().values.get("what").cloned();
|
||||
h.input_mut().events.push(Event::Text("extra".into()));
|
||||
h.run_steps(2);
|
||||
assert_ne!(h.state().dialog.as_ref().unwrap().values.get("what"), before.as_ref());
|
||||
key(&mut h, Key::Z, Modifiers::COMMAND);
|
||||
assert_eq!(h.state().dialog.as_ref().unwrap().values.get("what"), before.as_ref(), "Undo restores the Find field");
|
||||
assert_eq!((value(&h, "A1"), value(&h, "A2")), (Value::from("y1"), Value::from("y2")), "text-field Undo leaves the sheet alone");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn find_message_blocks_workbook_undo_and_redo() {
|
||||
let mut session = blank();
|
||||
session.execute("cell.set", json!({"cell": "A1", "input": "first"})).unwrap();
|
||||
session.execute("cell.set", json!({"cell": "A1", "input": "second"})).unwrap();
|
||||
session.execute("edit.undo", json!({})).unwrap();
|
||||
let mut h = harness(session);
|
||||
h.state_mut().open_dialog("find", json!({"replace": true}));
|
||||
h.run_steps(3);
|
||||
// An empty search raises the real modal error over Find and Replace.
|
||||
h.get_by_label("Replace All").click();
|
||||
h.run_steps(3);
|
||||
assert!(h.state().message.is_some());
|
||||
assert!(!h.ctx.text_edit_focused());
|
||||
for (key_code, modifiers) in [(Key::Z, Modifiers::COMMAND), (Key::Y, Modifiers::COMMAND), (Key::Z, Modifiers::COMMAND | Modifiers::SHIFT)] {
|
||||
key(&mut h, key_code, modifiers);
|
||||
assert_eq!(value(&h, "A1"), Value::from("first"), "the message blocks workbook shortcuts");
|
||||
assert!(h.state().message.is_some());
|
||||
}
|
||||
h.state_mut().message = None;
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Replace All").focus();
|
||||
h.run_steps(2);
|
||||
key(&mut h, Key::Y, Modifiers::COMMAND);
|
||||
assert_eq!(value(&h, "A1"), Value::from("second"), "Redo works again after dismissing the message");
|
||||
}
|
||||
#[test]
|
||||
fn shift_arrows_in_point_mode_extend_from_the_pointed_cell() {
|
||||
let mut s = blank();
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
# UI parity
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (Find and Replace keeps workbook Undo/Redo available while a button has keyboard focus; text fields keep their own Undo; earlier: punctuation shortcuts follow the keyboard layout's characters; earlier: preserve centered emoji and symbol fallback placement; earlier: preserve leading and trailing blank cell lines; earlier: align wrapped and unwrapped cells; earlier: CJK title baseline regression and mixed-script rendering validation; earlier: form controls: buttons, sliders and spin buttons on the sheet; earlier: Highlight the active cell's row, a global preference in File › Options › General; earlier: a linked cell's menu edits, opens or removes the link; earlier: Display options for this workbook: sheet tabs and scroll bars; earlier: dragging over row or column headers in point mode extends the reference; earlier: a picture on the system clipboard pastes as a floating picture at the active cell with Cmd/Ctrl+V or Paste (#699); earlier: frozen columns keep their text, gridlines and merged borders whole while the sheet scrolls (#2544); earlier: every Paste Special option has its access key; earlier: the Draw tab's live stroke preview uses the pen's colour and thickness; earlier: copy quotes only cells with a tab or line break, as Excel does; earlier: Ctrl+. Next Corner of Selection; earlier: dragging the selection's border onto data asks before replacing it; earlier: RefEdit reference boxes in dialogs: Goal Seek, Solver and Data Analysis use them, the arrow keys select while a dialog is collapsed and F4 cycles a reference's anchors; earlier: Python cells: Python mode in the formula bar; earlier: Insert › Equation and the equation editor; earlier: every floating object selects, resizes from eight handles and deletes with the keyboard; earlier: Formulas › Error Checking › Trace Error; trace arrows stay through a zoom (#3097); earlier: Page Setup sets the page order, Down, then over or Over, then down, which printing, the print preview, Page Break Preview and Page Layout view follow; earlier: Formulas › Function Library as labelled buttons with category menus; Recently Used and the Insert Function categories; Esc leaves a File-page text field before closing the view; earlier: checkbox cells print as boxes; Ctrl+arrow and Ctrl+Shift+arrow while pointing a formula reference; editing a hyperlink loads its existing fields; AutoSum over a selected row puts its total to the right; ribbon catalog count 276 / 292) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-05 · **Change:** minor (punctuation shortcuts follow the keyboard layout's characters; earlier: preserve centered emoji and symbol fallback placement; earlier: preserve leading and trailing blank cell lines; earlier: align wrapped and unwrapped cells; earlier: CJK title baseline regression and mixed-script rendering validation; earlier: form controls: buttons, sliders and spin buttons on the sheet; earlier: Highlight the active cell's row, a global preference in File › Options › General; earlier: a linked cell's menu edits, opens or removes the link; earlier: Display options for this workbook: sheet tabs and scroll bars; earlier: dragging over row or column headers in point mode extends the reference; earlier: a picture on the system clipboard pastes as a floating picture at the active cell with Cmd/Ctrl+V or Paste (#699); earlier: frozen columns keep their text, gridlines and merged borders whole while the sheet scrolls (#2544); earlier: every Paste Special option has its access key; earlier: the Draw tab's live stroke preview uses the pen's colour and thickness; earlier: copy quotes only cells with a tab or line break, as Excel does; earlier: Ctrl+. Next Corner of Selection; earlier: dragging the selection's border onto data asks before replacing it; earlier: RefEdit reference boxes in dialogs: Goal Seek, Solver and Data Analysis use them, the arrow keys select while a dialog is collapsed and F4 cycles a reference's anchors; earlier: Python cells: Python mode in the formula bar; earlier: Insert › Equation and the equation editor; earlier: every floating object selects, resizes from eight handles and deletes with the keyboard; earlier: Formulas › Error Checking › Trace Error; trace arrows stay through a zoom (#3097); earlier: Page Setup sets the page order, Down, then over or Over, then down, which printing, the print preview, Page Break Preview and Page Layout view follow; earlier: Formulas › Function Library as labelled buttons with category menus; Recently Used and the Insert Function categories; Esc leaves a File-page text field before closing the view; earlier: checkbox cells print as boxes; Ctrl+arrow and Ctrl+Shift+arrow while pointing a formula reference; editing a hyperlink loads its existing fields; AutoSum over a selected row puts its total to the right; ribbon catalog count 276 / 292) · **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
|
||||
@@ -275,7 +275,6 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12.
|
||||
| 2026-11-04 | minor | Preserve leading and trailing blank lines in wrapped cells when calculating vertical alignment; regression covers single, multiple and all-empty lines |
|
||||
| 2026-11-04 | minor | Align wrapped and unwrapped cells with the same vertical margins; regressions compare numbers with mixed CJK/Latin text, including explicit line breaks |
|
||||
| 2026-11-02 | minor | Form controls: buttons, sliders (scroll bars) and spin buttons placed, worked, selected and edited on the sheet (Insert › Controls, Assign Action, Format Control); catalog 281 / 296 |
|
||||
| 2026-11-03 | minor | Find and Replace: workbook Undo/Redo works with a keyboard-focused button; focused text fields keep text-editing Undo, and a modal message blocks workbook shortcuts. Regression covers Replace All, both Redo shortcuts, actual text undo, and an error message |
|
||||
| 2026-11-03 | minor | Highlight the active cell's row: a global preference that tints the whole row, off by default |
|
||||
| 2026-11-03 | minor | The formula bar's bottom edge is a resize handle: dragging it sets the bar's height in whole lines, up to half the window, and dragging it to one line collapses it; expanding (the chevron, Ctrl+Shift+U) returns to the dragged height, which is kept with the UI preferences. `view.expandFormulaBar {lines}` sets it (#1246) |
|
||||
| 2026-11-03 | minor | Cell context menu on a cell with a link: Edit Hyperlink… (the link dialog, titled Edit Hyperlink and filled with the link), Open Hyperlink and Remove Hyperlink, as in Excel, instead of Link… (#2120) |
|
||||
|
||||
Reference in New Issue
Block a user