Skip to content

Edit Points: Esc before releasing the mouse button cancels a point or handle drag - #1325

Merged
aiongg merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/edit-points-escape-cancels-drag
Oct 25, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/edit-points-escape-cancels-drag

Conversation

@dotCooCoo

@dotCooCoo dotCooCoo commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

In Edit Points, pressing Esc while dragging a point or one of its handles left Edit Points, but the drag went on: the point kept following the pointer, and the release added an "Edit Points" undo step. Microsoft's support article says: "To cancel the change to the point and line segments, press Esc before releasing the mouse button." (Draw or edit a freeform shape)

What changes:

  • Session::cancel_point_drag in crates/engine/src/tools.rs ends a vertex or handle drag and puts back the document and selection from the press. It adds no undo step.
  • In crates/engine/src/keys.rs, Esc calls it first, and the rest of the drag and the release change nothing. The support article does not say whether Edit Points stays on; in DeckCraft it stays on after a cancelled drag, and Esc without a drag still leaves Edit Points.
  • The ROADMAP.md progress log has a line for it.

Test: tests::edit_points_escape_cancels_a_point_or_handle_drag drags a point of an ellipse, presses Esc, drags further and releases, then drags one of the point's handles, presses Esc and releases. After each, it checks that the shape's geometry matches the geometry before the press, that the undo stack has the same length, and that Edit Points is still on. It fails on main at the first check after Esc ("Esc puts the point back"). With the line that ends the drag removed, it fails at the check that no drag is in progress.

Checks: cargo test -p deckcraft-engine --lib edit_points (10 tests), cargo fmt --all -- --check, cargo clippy -p deckcraft-engine --all-targets -- -D warnings, cargo xtask assets and cargo xtask layers.

This branch and #1308 (handle drag modifiers) change different lines of tools.rs, tests.rs and ROADMAP.md. git merge-tree merges the two without conflicts, and the edit_points tests pass on the merged tree (11 tests).

On Windows 11 (x86-64) with rustc 1.99.1, on top of main at 38d2ade, with #1292, #1298 and #1300 merged in:

  • cargo xtask ci passes its 8 steps: 1,881 tests passed, 0 failed, 6 ignored.

Without #1298, control_server::tests::blocked_ui_times_out_and_full_queue_is_busy fails intermittently on main at 38d2ade too (3 of 40 runs of the control_server tests); #1298 fixes it.

git merge-tree reports no conflicts with main at 38d2ade.

Summary by CodeRabbit

  • Bug Fixes
    • Pressing Esc during an Edit Points vertex or handle drag now restores the original shape without creating an undo step. Further mouse movement and release do not resume the cancelled drag, and Edit Points remains active.
    • Pressing Esc when no point drag is active still exits Edit Points.

… handle drag

Esc during a vertex or handle drag in Edit Points used to leave Edit
Points while the drag went on: the point kept following the pointer and
the release added an undo step. Esc now ends the drag and puts the shape
back as it was at the press, with no undo step, and Edit Points stays on.
Esc without a drag still leaves Edit Points.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 38d2ade and 8f31193.

Files selected for processing: 4
  • ROADMAP.md
  • crates/engine/src/keys.rs
  • crates/engine/src/tests.rs
  • crates/engine/src/tools.rs

Limit details: You’ve used all 10 included reviews currently available.

Walkthrough

Escape now cancels an active Edit Points vertex or handle drag, restores its saved geometry and selection when needed, and adds no undo step. Escape without an active drag continues through the existing key handling.

Changes: Edit Points drag cancellation

Layer / File(s) Summary
Restore the saved drag state
crates/engine/src/tools.rs
cancel_point_drag clears an active vertex or handle drag. When the saved document differs from the current document, it restores the saved document and selection and increments the revision. It does not add an undo step.
Handle Escape and test cancellation
crates/engine/src/keys.rs, crates/engine/src/tests.rs, ROADMAP.md
Session::key checks Escape or Esc for an active point drag before other key handlers. A regression test checks restored geometry, no undo step, ignored later drag events, and Edit Points mode behavior. The progress log records the change.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: marcoarnulfo

Merge Risk: Minimal · up to 8f311

Escape cancellation preserves the intended editing flow, with no identified issue requiring a fix before merge.

Security architecture risk: Low · up to 8f311

The change does not introduce new editing permissions or external access. The main design risk is that cancelling a drag can also discard other edits accepted during that drag, rather than only the point movement.

Retained concerns

  • Medium · reliability · inferred: Cancellation restores the complete pre-drag presentation, but successful Session edits are not isolated from the open interaction. An intervening edit can therefore be discarded together with the drag, without a separate undo entry. The base already grouped such edits into the interaction; the new cancellation terminal state adds a path that discards that group. The normal single-document regression test supports the intended gesture behavior but does not resolve this interleaving case.
Security review details

Security Blast Radius

  • inferred — The introduced rollback outcome is bounded to the active presentation and selection in an existing editing Session. Intervening edits elsewhere in that presentation can be affected because the snapshot covers the whole document.

Trust Boundaries and Controls

  • observed — Existing UI, control-channel, and MCP callers already forward key input to Session::key. Those routes are unchanged by this PR; the added Escape branch does not grant an additional caller identity or editing capability.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: pressing Esc during an Edit Points vertex or handle drag cancels the drag before mouse release.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 4
  • Waived: $1.00 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Comment @coderabbitai help to get the list of available commands.

@aiongg
aiongg merged commit 85db5ca into storytold:main Oct 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants