Repository navigation
fix(grid): keep cursor stable during cell dragging (#936) - #1095
Merged
Merged
Conversation
Co-Authored-By: Codex <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Dragging a cell selection could switch the requested cursor between Cell, Move and Crosshair as the pointer crossed the changing selection border and fill handle. Other grid drags could also lose their cursor over unrelated hover targets.
Root cause
The hover cursor block ran before the grid processed drag state changes, and continued hit-testing during active drags. It could overwrite the cursor for the actual operation and miss the first drag frame.
Changes
Regression tests
crates/ui-egui/tests/drag_cursor.rsdrives the real SheetApp through egui pointer press, movement and release events, assertingplatform_output.cursor_iconon movement and following idle frames. It also checks selection, filled values, moved values/columns, resized dimensions, freeze counts and ink creation.Coverage includes selection borders and fill handles, frozen panes, leaving the grid, RTL coordinates, fill, moves, both resize/freeze axes, column reordering, whole-line selection, object move/resize, Draw cursors and hover tracking, and a rapid press following a click.
Eight behavioral assertions failed against unchanged upstream grid code (including Select requesting Move and Fill requesting Cell). All ten final cursor tests pass with this change.
Validation
cargo test --offline -p gridcraft-ui-egui --test drag_cursor: 10 passed.cargo fmt --all -- --checkandgit diff --check: passed.cargo xtask ci: all eight gates passed (fmt, Clippy with warnings denied, workspace tests, assets, layers, WASM, Parity and Keytips). Workspace tests: 1607 passed, zero failed, one timing benchmark ignored by default. Run on Windows with Rust 1.99.0,CARGO_BUILD_JOBS=1andRUST_TEST_THREADS=2.An initial parallel compilation exhausted Windows commit memory/page-file capacity. Retrying with one Cargo build job succeeded for the targeted UI suites. No global configuration was changed.
The first completed CI run reached Parity after passing fmt, Clippy, workspace tests, assets, layers and WASM, but the generated-file checks compared the Windows CRLF checkout with LF output. Converting only the three generated working copies to LF made Parity and Keytips pass; each normalized file's Git blob hash equals upstream/main, and no generated-file change is included in the commit. The WASM check retains an existing dead-code warning for
Modified::AtandModified::Unknownin unchangedbackstage.rs.Scope / limitations
This fixes cursor priority for the existing drag modes. It does not add header arrow cursors, a custom white cell cursor, assets, settings, animation changes or select-on-press behavior. No unmerged code from #909 or #927 is included; those interaction changes may require a rebase if merged first. The work is independent of #969.
Windows native cursor sampling, other operating systems, touch input and every object kind were not exercised. The cursor evidence is egui output from simulated pointer events on Windows; a PNG cannot establish native cursor stability.
Prepared with Codex assistance. The commit uses the Codex co-author identity already accepted in GridCraft.
Related Issue
Fixes #936