From 7c29077acd459b091ff41846c564074d4b1d9408 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 8 Nov 2016 13:45:12 +0100 Subject: [PATCH] app: allow to remove the last added IScissors segment with backspace --- app/tools/gimpiscissorstool.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/app/tools/gimpiscissorstool.c b/app/tools/gimpiscissorstool.c index 4ef6230c95..047e747e12 100644 --- a/app/tools/gimpiscissorstool.c +++ b/app/tools/gimpiscissorstool.c @@ -1070,6 +1070,22 @@ gimp_iscissors_tool_key_press (GimpTool *tool, switch (kevent->keyval) { + case GDK_KEY_BackSpace: + if (! iscissors->curve->closed && + g_queue_peek_tail (iscissors->curve->segments)) + { + gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool)); + + gimp_iscissors_tool_push_undo (iscissors); + icurve_delete_segment (iscissors->curve, + g_queue_peek_tail (iscissors->curve->segments)); + gimp_iscissors_tool_free_redo (iscissors); + + gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool)); + return TRUE; + } + return FALSE; + case GDK_KEY_Return: case GDK_KEY_KP_Enter: case GDK_KEY_ISO_Enter: @@ -2090,11 +2106,10 @@ icurve_delete_segment (ICurve *curve, { next_segment->x1 = segment->x1; next_segment->y1 = segment->y1; - - g_queue_remove (curve->segments, segment); - - isegment_free (segment); } + + g_queue_remove (curve->segments, segment); + isegment_free (segment); } static void