diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index dc975c592..6ae386fef 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -722,6 +722,9 @@ pub fn show(app: &mut SheetApp, ui: &mut egui::Ui) { app.grid.cells_rect = Some(geo.mirror_rect(geo.cells)); // The selection outline glides to a new selection. It stays on its cells when Animations is // off, when egui's animations are (the headless harness), and while a screenshot is on its way. + // A mouse button held down (a click or a drag selecting cells) moves it at once, as in Excel: + // a gliding outline trails the pointer and reads as lag. + let pointer_selecting = ui.input(|i| i.pointer.any_down()); let outline = app.grid.glide.frame(crate::selection_glide::Frame { place, range: sel.current(), @@ -729,7 +732,7 @@ pub fn show(app: &mut SheetApp, ui: &mut egui::Ui) { view: geo.cells, now, frame_nr: ui.ctx().cumulative_frame_nr(), - animate: app.ui.animations && ui.ctx().global_style().animation_time > 0.0 && !app.shots.in_flight(), + animate: app.ui.animations && ui.ctx().global_style().animation_time > 0.0 && !app.shots.in_flight() && !pointer_selecting, }); if app.grid.glide.is_gliding() { ui.ctx().request_repaint(); diff --git a/crates/ui-egui/tests/selection_glide.rs b/crates/ui-egui/tests/selection_glide.rs index fd8bf4e73..c8c253ac8 100644 --- a/crates/ui-egui/tests/selection_glide.rs +++ b/crates/ui-egui/tests/selection_glide.rs @@ -201,3 +201,29 @@ fn agents_find_run_and_read_the_setting_over_the_control_channel() { assert_eq!(set["result"]["animations"], json!(true)); assert!(a.ui.animations); } + +#[test] +fn a_mouse_drag_keeps_the_outline_on_its_cells() { + // A gliding outline trails the pointer while selecting with the mouse and reads as lag; Excel + // draws it on the selection at once. Keyboard moves still glide (above). + let mut h = animated(); + let (b2, e8) = (cell_rect(&h, "B2"), cell_rect(&h, "E8")); + let m = egui::Modifiers::NONE; + h.input_mut().events.extend([ + egui::Event::PointerMoved(b2.center()), + egui::Event::PointerButton { pos: b2.center(), button: egui::PointerButton::Primary, pressed: true, modifiers: m }, + ]); + h.step(); + for k in 1..=6 { + let p = b2.center() + (e8.center() - b2.center()) * (k as f32 / 6.0); + h.input_mut().events.push(egui::Event::PointerMoved(p)); + steps(&mut h, 2); + let sel = h.state().session.active().map(|d| d.selection.current()).unwrap(); + let shown = cell_rect(&h, &sel.start.a1()).union(cell_rect(&h, &sel.end.a1())); + assert!(!gliding(&h), "no glide while the button is held"); + assert_eq!(outline(&h), shown, "the outline is on the dragged range {}", sel.a1()); + } + h.input_mut().events.push(egui::Event::PointerButton { pos: e8.center(), button: egui::PointerButton::Primary, pressed: false, modifiers: m }); + h.step(); + assert_eq!(h.state().session.active().map(|d| d.selection.current().a1()).as_deref(), Some("B2:E8")); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index cbcf9b758..835c6b00e 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-19 · **Change:** minor (Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846; Ctrl+6 hides and shows objects) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846; Ctrl+6 hides and shows objects; the selection outline follows a mouse drag at once) · **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 @@ -162,6 +162,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. | Date | Change | Summary | |---|---|---| +| 2026-10-19 | trivial | While a mouse button is held (a click or a drag selecting cells) the selection outline is drawn on its cells at once instead of gliding after the pointer, which read as lag; keyboard moves still glide | | 2026-10-19 | minor | Ctrl+Enter (`range.fill`) gives each cell what typing the input there gives: a General cell gets the automatic number format (`5%`, `$5`, `3/4/2026`, `=TODAY()`) even when it already held a value, and a cell with its own format, a formatted row or column, or Text keeps it. Cells that held a value used to keep General (`5%` showed 0.05), and empty cells took the active cell's format | | 2026-10-18 | minor | Keytip letters typed with left Alt held continue the sequence (Alt+H, O, A / Alt+H, O, I ran nothing before: Alt+letter cancelled keytips); other Alt combinations, AltGr and macOS Option are unchanged (#1846) | | 2026-10-16 | minor | Ctrl+6 hides every object (charts, pictures, shapes, slicers) and shows them again; hidden objects are not drawn, take no clicks and drop their selection, and the setting is saved with the workbook (`workbookPr showObjects`) |