[gimp] app: do not add undo step when clearing an already empty channel.



commit 9c940722131678fd7b4246b100d5f1430f5f327c
Author: Jehan <jehan girinstud io>
Date:   Wed Sep 13 12:59:29 2017 +0200

    app: do not add undo step when clearing an already empty channel.
    
    See also bug 787545 about single-clicking with a selection tool creating
    an undo step even when there were already no selections.

 app/core/gimpchannel.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 418079e..8725a23 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1316,10 +1316,14 @@ gimp_channel_real_clear (GimpChannel *channel,
 {
   if (push_undo)
     {
-      if (! undo_desc)
-        undo_desc = GIMP_CHANNEL_GET_CLASS (channel)->clear_desc;
+      if (! channel->empty)
+        {
+          /* Don't push an undo if the channel was already empty. */
+          if (! undo_desc)
+            undo_desc = GIMP_CHANNEL_GET_CLASS (channel)->clear_desc;
 
-      gimp_channel_push_undo (channel, undo_desc);
+          gimp_channel_push_undo (channel, undo_desc);
+        }
     }
   else
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]