Skip to content

fix(slides): dragging several selected slides moves them all - #1418

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
fchinu:fix/multi-slide-drag
Oct 30, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
fchinu:fix/multi-slide-drag

Conversation

@fchinu

@fchinu fchinu commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Dragging one of several selected slides in the thumbnail pane or the Slide Sorter moved only the slide under the pointer. Now the whole selection moves, as PowerPoint does:

  • The selected slides land together at the drop point, in the order they were in.
  • They stay selected.
  • One undo step puts them all back.
  • With sections, they join the section they land in.
  • Dragging an unselected slide still moves only that slide, and it becomes the selection.
  • Dropping a selection where it already is does nothing and adds no undo step.

Changes

Engine: slide.move takes ids (crates/engine/src/cmd/slide.rs)

  • New form: {ids: [slide id], to}. to is counted in the deck without the moved slides. The old {from?, to} form is unchanged.
  • Ids are checked against the deck while they are parsed. The first unknown id is an error and the deck stays as it was. Repeats fold together, so the work never grows past the deck size, even with a huge or hostile list.
  • The section update is now a shared helper, reassign_sections. It uses a position map, not a position() call per slide.
  • The selection becomes the moved slides.

UI: the drag carries every dragged slide (crates/ui-egui/src/thumbs.rs, sorter.rs, lib.rs)

  • thumb_drag is now a SlideDrag { uid, ids, slot }. Both views use the same helpers: start_slide_drag, slide_drag_live, slides_move_dest and drop_slide_drag.
  • A drag started in one presentation never applies in another. This is the same uid guard the Sorter's inline rename uses.
  • Fixes a latent bug (already on main): if no view saw a drag's release, the drag stayed live. That happens when a Sorter double-click opens Normal view mid-gesture, and it was reproduced through the control channel. The next unrelated release in the thumbnail pane then moved slides. A drag is now dropped once the primary button is neitherheld nor just released.
  • Normal-view thumbnails now carry a Slide N accessibility label, like the Sorter cells, so tests can drag them.

Tests

  • Engine: non-contiguous ids moved to the front, middle and end; ids given backwards; to past the end; selection after the move; one undo and one redo; sections, including a section emptied by the move; bad ids (empty, unknown, negative, string, float, u64::MAX, not a list, 100k unknown ids, 100k repeats); the legacy {from, to} path.
  • UI harness: real multi-frame drags in the Sorter and the thumbnail pane, for a selected group, an unselected slide and an in-place drop. Also covered: a drag across a document switch, a drag whose release was missed, and the pure slides_move_dest cases.

Docs

  • docs/ui-parity.md: row, status line and revision history.
  • ROADMAP.md: status line, progress log and revision history.
  • docs/gaps.md had no matching entry. The "Reorder slides" checklist row stays D.

Checks

cargo xtask ci on top of main (aaf6c1c): fmt, clippy (-D warnings), layers, assets, wasm and doctests all pass.

The full test run with --no-fail-fast passes except one test that already fails on main locally: deckcraft-pdf tests::unembeddable_font_returns_error_instead_of_a_pdf_missing_text. It depends on the local font setup and is unrelated to this change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Drag a selected group of slides in the thumbnail pane or Slide Sorter to move them together, keeping their existing order.
    • The moved slides remain selected, and the group move can be undone as a single action.
    • Dragging an unselected slide moves only that slide, even when other slides are selected. Dropping slides back in the same position does not add an undo action.

Dragging one of several selected slides in the thumbnail pane or the
Slide Sorter moved only the dragged slide. Now the whole selection moves
as one run in deck order, in one undo step, stays selected and joins the
section it lands in; an unselected slide still moves alone.

- slide.move takes `ids` (checked against the deck while parsed, repeats
  fold), alongside the unchanged `{from, to}`.
- The slide drag records its slides and the presentation it began in; a
  drag in another presentation, or one whose release no view saw (a
  Sorter double-click opening Normal view mid-gesture), is dropped
  instead of moving slides on a later release.
- Normal-view thumbnails carry a "Slide N" label, like Sorter cells.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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 aaf6c1c and 039395a.

Files selected for processing: 7
  • ROADMAP.md
  • crates/engine/src/cmd/slide.rs
  • crates/ui-egui/src/lib.rs
  • crates/ui-egui/src/sorter.rs
  • crates/ui-egui/src/sorter_tests.rs
  • crates/ui-egui/src/thumbs.rs
  • docs/ui-parity.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The slide.move command now supports moving multiple slides as one run. The thumbnail pane and Slide Sorter share drag handling for selected slides. Tests cover grouped moves, selection, undo, no-op drops, and invalidated drags.

Changes: Grouped slide dragging

Layer / File(s) Summary
Multi-slide move command
crates/engine/src/cmd/slide.rs
slide.move accepts ids, preserves deck order, and moves the slides as one run. The command updates selection and section membership. Tests cover movement, undo/redo, section assignment, and invalid IDs.
Shared drag lifecycle and UI integration
crates/ui-egui/src/thumbs.rs, crates/ui-egui/src/lib.rs, crates/ui-egui/src/sorter.rs, crates/ui-egui/src/sorter_tests.rs, ROADMAP.md, docs/ui-parity.md
The thumbnail pane and Slide Sorter use shared drag state and helpers. Selected slides move together, while dragging an unselected slide moves only that slide. Tests cover drop behavior and undo; the roadmap and parity documentation record the behavior.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant UI as Thumbnail pane or Slide Sorter
  participant Thumbs as thumbs.rs
  participant Command as slide.move
  participant Deck as Deck state
  User->>UI: Drag a thumbnail
  UI->>Thumbs: Start and update drag
  User->>UI: Release at destination
  UI->>Thumbs: Drop slide drag
  Thumbs->>Command: Move selected slide IDs to destination
  Command->>Deck: Reorder slides and update selection and sections
Loading

Suggested reviewers: nikitkara

Merge Risk: Minimal · up to 03939

No merge-blocking issue was established for grouped slide dragging. The change is ready to merge after normal checks.

Security architecture risk: Low · up to 03939

Grouped moves remain limited to the active presentation and retain existing undo protections. No increased editing authority was identified. Deployed automation access and request limits remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — One request can now reorder every slide in the active presentation and update associated sections and selection. This increases per-command editing scope, but existing command access already permits repeated slide mutations. The inspected change does not add access to another presentation, credentials, services, or infrastructure.

Security Findings and Attack Paths

  • inferred — No introduced material attack path was established. Caller-supplied IDs reach document reordering through existing dispatchers, but membership validation precedes mutation. Large lists incur linear input work without a new list-length-times-deck amplification. Deployment exposure and authentication remain unknown, so this conclusion is limited to the inspected source paths.

Trust Boundaries and Controls

  • observed — Drag state records the originating presentation UID. Liveness rejects a different active presentation or an ended gesture, and drop independently rechecks the UID and current membership of all dragged IDs. State is taken before validation or submission, preventing the same stored drag from being applied twice.

Resilience and Maintainability Implications

  • observed — Session execution requires exclusive mutable access, and the grouped edit uses the existing transactional document replacement and history path. Invalid IDs return before replacement, containing partial-failure effects within the active document. Same-document edits between drag initiation and drop are handled by re-resolving current IDs and positions, not by a revision-token check.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 44.19% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 5 files. (2 skipped: … 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 "fix(slides): dragging several selected slides moves them all" names the main change. The PR makes dragging a selected slide move the whole selection as one group in the thumbnail pane and S…
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: Title check

Explanation

The title "fix(slides): dragging several selected slides moves them all" names the main change. The PR makes dragging a selected slide move the whole selection as one group in the thumbnail pane and Slide Sorter, and adds an ids form to slide.move. The title is specific, uses a conventional commit prefix, and contains no vague terms. It omits the engine ids form and the missed-release handling, which is acceptable because it does not need to cover every detail.

Full details: Docstring Coverage

Explanation

Docstring coverage is 44.19% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 43 functions across 5 files. (2 skipped: 2 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

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.99.0)

Clippy execution timed out

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

@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit ecad13d into storytold:main Oct 30, 2026
7 checks passed
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 30, 2026
fix(slides): dragging several selected slides moves them all
@echelon

echelon commented Oct 30, 2026

Copy link
Copy Markdown
Member

Landed on main, thank you @fchinu for the contribution! If you haven't already, come join us on Discord: https://discord.gg/artcraft

@echelon

echelon commented Oct 30, 2026

Copy link
Copy Markdown
Member

Note on what I changed before landing: merged main in and carried the change onto the split files (panels/thumbs.rs, sorter/ui_tests.rs).

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.

3 participants