mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 17:53:27 +00:00
Merge pull request #531 from wesnoth/gfgtdf-patch-1
fix selected item after deletion in a ordered list
This commit is contained in:
commit
df3c4df5e8
@ -74,14 +74,15 @@ void tone::delete_item(const unsigned index)
|
|||||||
|
|
||||||
// Are there items left?
|
// Are there items left?
|
||||||
const unsigned item_count = get_item_count();
|
const unsigned item_count = get_item_count();
|
||||||
|
const unsigned visible_index = get_ordered_index(index);
|
||||||
if(item_count > 1) {
|
if(item_count > 1) {
|
||||||
// Is the last item deselected?
|
// Is the last item deselected?
|
||||||
if(index == item_count - 1) {
|
if(visible_index == item_count - 1) {
|
||||||
// Select the second last.
|
// Select the second last.
|
||||||
do_select_item(index - 1);
|
do_select_item(get_item_at_ordered(visible_index - 1));
|
||||||
} else {
|
} else {
|
||||||
// Select the next item.
|
// Select the next item.
|
||||||
do_select_item(index + 1);
|
do_select_item(get_item_at_ordered(visible_index + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user