Skip to content

Commit

Permalink
Merge pull request #531 from wesnoth/gfgtdf-patch-1
Browse files Browse the repository at this point in the history
fix selected item after deletion in a ordered list
  • Loading branch information
gfgtdf committed Oct 17, 2015
2 parents cb9d873 + cdf68f1 commit df3c4df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gui/widgets/generator.cpp
Expand Up @@ -74,14 +74,15 @@ void tone::delete_item(const unsigned index)

// Are there items left?
const unsigned item_count = get_item_count();
const unsigned visible_index = get_ordered_index(index);
if(item_count > 1) {
// Is the last item deselected?
if(index == item_count - 1) {
if(visible_index == item_count - 1) {
// Select the second last.
do_select_item(index - 1);
do_select_item(get_item_at_ordered(visible_index - 1));
} else {
// Select the next item.
do_select_item(index + 1);
do_select_item(get_item_at_ordered(visible_index + 1));
}
}
}
Expand Down

0 comments on commit df3c4df

Please sign in to comment.