Skip to content

Undoing dragged-crossed cells does not follow a logical order #973

@ocus

Description

@ocus

When undoing cells that have been crossed by dragging, it does not seem to follow a logical order.

Setup

(Demonstrated on the Level Builder for better visualization but the behaviour is the same on every available level.)

Place 3 crossed cells by click-dragging:
Image

Resulting grid:
Image

Crossed cells are numbered 1, 2 and 3, in the order they were added.

Then, press the "Undo" button 3 times in a row, without otherwise interacting with the grid.

Expected Behavior

Cells are uncrossed in the reverse order: 3 then 2 then 1.

After one "Undo":
Image
Cell 3 is uncrossed.

After two "Undo":
Image
Cell 2 is uncrossed.

After three "Undo":
Image
Cell 1 is uncrossed, and the grid is empty, as it was before crossing the 3 cells.

Current Behavior

After one "Undo":
Image
✅ Cell 3 is uncrossed.

After two "Undo":
Image
❌ Cell 1 is uncrossed.

After three "Undo":
Image
❌ Cell 2 is uncrossed.

This behaviour is encountered for any non-self-intersecting click-drag pattern, of any length (2+), drawn in any direction.

❌ For a pattern of length N, crosses are removed in the order N, N-1, N-2, ... 1, 2.
✅ We would expect crosses to be removed in the order N, N-1, N-2, ... 2, 1.

NB: self-intersecting patterns behave weirdly too, but I let the developper explore the issue. Example of pattern with weird undoing sequence, traced in a single click-drag (pattern starts at the circle):

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions