From e4a2b7f7a9a8e5f05d1f06f70e252adea149813e Mon Sep 17 00:00:00 2001 From: Guillaume Chereau Date: Sun, 7 Jul 2024 15:52:20 +0800 Subject: [PATCH] Don't push to undo history when no change This can happen for example if we just moved the selection box. --- src/image.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/image.c b/src/image.c index 0136a6b68..dfd5d8123 100644 --- a/src/image.c +++ b/src/image.c @@ -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) {