From a39355ca4d69fe3c2e9f8a0fa63805cd82b4805d Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Tue, 17 Jun 2025 14:01:24 +0000 Subject: [PATCH] actions: Select next palette entry after deletion Unlike other dockables such as brush and patterns, deleting a palette color does not automatically select the next one. This makes it difficult to delete multiple colors in a row. This patch gets the current index before deleting the color, and then uses it to select the next entry afterwards. --- app/actions/palette-editor-commands.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/actions/palette-editor-commands.c b/app/actions/palette-editor-commands.c index 4c18ef5c87..ec13bf8114 100644 --- a/app/actions/palette-editor-commands.c +++ b/app/actions/palette-editor-commands.c @@ -79,8 +79,17 @@ palette_editor_delete_color_cmd_callback (GimpAction *action, if (data_editor->data_editable && editor->color) { GimpPalette *palette = GIMP_PALETTE (data_editor->data); + gint index; + + index = gimp_palette_get_entry_position (palette, editor->color); gimp_palette_delete_entry (palette, editor->color); + + if (index >= gimp_palette_get_n_colors (palette)) + index = gimp_palette_get_n_colors (palette) - 1; + + gimp_palette_view_select_entry (GIMP_PALETTE_VIEW (editor->view), + gimp_palette_get_entry (palette, index)); } }