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.
This commit is contained in:
Alx Sa 2025-06-17 14:01:24 +00:00
parent 2defc3d07b
commit a39355ca4d

View file

@ -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));
}
}