Skip to content

Commit

Permalink
When deleting a file using the delete dialog, move to the next one
Browse files Browse the repository at this point in the history
Fixes #841
  • Loading branch information
crudelios committed Jul 11, 2023
1 parent 5a26c58 commit 4411e42
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/window/file_dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ static struct {
} info;
savegame_load_status savegame_info_status;
int redraw_full_window;
int selected_index;
} data;

static const int MISSION_ID_TO_CITY_ID[] = {
Expand Down Expand Up @@ -540,6 +541,7 @@ static void button_ok_cancel(int is_ok, int param2)
if (scrollbar.scroll_position < 0) {
scrollbar.scroll_position = 0;
}
button_select_file(data.selected_index - 1, 0);
}
}

Expand All @@ -555,6 +557,7 @@ static void button_select_file(int index, int param2)
{
if (index < data.file_list->num_files &&
strcmp(data.selected_file, data.file_list->files[scrollbar.scroll_position + index]) != 0) {
data.selected_index = index + 1;
strncpy(data.selected_file, data.file_list->files[scrollbar.scroll_position + index], FILE_NAME_MAX - 1);
encoding_from_utf8(data.selected_file, data.typed_name, FILE_NAME_MAX);
string_copy(data.typed_name, data.previously_seen_typed_name, FILE_NAME_MAX);
Expand Down

0 comments on commit 4411e42

Please sign in to comment.