Grid: the selection outline follows a mouse drag at once

The outline glides 0.12 s toward each new selection. While selecting with the mouse that makes
it trail the pointer, which reads as lag (the grid itself paints in under a millisecond per
frame). With a mouse button held it is now drawn on its cells at once, as in Excel; keyboard
moves still glide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: MH <q6rrzz@gmail.com>
This commit is contained in:
MHandClaude Opus 5.5 committed 2026-10-19 21:40:23 +03:00
1 parent 49fe41afbf
commit ef339b9f2c
3 files changed
+32 -2

No files matched your search

+4 -1
View File
@@ -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();
+26
View File
@@ -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"));
}
+2 -1
View File
@@ -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) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** trivial (the selection outline follows a mouse drag at once; it still glides for keyboard moves) · **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-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-12 | minor | The File view's recent list tells when each workbook was last changed, read off the UI thread |