Skip to content

Commit

Permalink
Don't push to undo history when no change
Browse files Browse the repository at this point in the history
This can happen for example if we just moved the selection box.
  • Loading branch information
guillaumechereau committed Jul 7, 2024
1 parent ef2499e commit e4a2b7f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,13 @@ void image_history_push(image_t *img)
{
image_t *snap;

// Don't do anything if the image didn't actually changed.
if (img->history_pos) {
if (image_get_key(img) == image_get_key(img->history_pos)) {
return;
}
}

// Discard previous undo.
if (img->history_pos) {
while (img->history_pos->history_next) {
Expand Down

0 comments on commit e4a2b7f

Please sign in to comment.