Skip to content

Commit

Permalink
Include element indexes in undo item when deleting selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tmoerschell authored and bhennion committed Apr 6, 2024
1 parent bc55e17 commit 9676776
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/core/control/tools/EditSelectionContents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,8 @@ auto EditSelectionContents::setColor(Color color) -> UndoActionPtr {
void EditSelectionContents::fillUndoItem(DeleteUndoAction* undo) {
Layer* layer = this->sourceLayer;

// Always insert the elements on top
// Because the elements are already removed
// and owned by the selection, therefore the layer
// doesn't know the index anymore
Element::Index index = as_signed(layer->getElements().size());
for (auto& [e, _]: this->insertionOrder) {
undo->addElement(layer, std::move(e), index);
for (auto& [e, pos]: this->insertionOrder) {
undo->addElement(layer, std::move(e), pos);
}

this->selected.clear();
Expand Down

0 comments on commit 9676776

Please sign in to comment.