[FL-2495] Archive: Refresh file list on application exit #1170

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov
2022-04-27 19:34:37 +03:00
committed by GitHub
parent 2034b6ac4a
commit 19f42c5290
4 changed files with 50 additions and 10 deletions

View File

@@ -77,6 +77,7 @@ void archive_set_item_count(ArchiveBrowserView* browser, uint32_t count) {
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
model->item_cnt = count;
model->item_idx = CLAMP(model->item_idx, model->item_cnt - 1, 0);
return false;
});
}
@@ -397,15 +398,17 @@ void archive_enter_dir(ArchiveBrowserView* browser, string_t name) {
archive_dir_count_items(browser, string_get_cstr(name));
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
idx_last_array_push_back(model->idx_last, model->item_idx);
model->array_offset = 0;
model->item_idx = 0;
return false;
});
if(string_cmp(browser->path, name) != 0) {
with_view_model(
browser->view, (ArchiveBrowserViewModel * model) {
idx_last_array_push_back(model->idx_last, model->item_idx);
model->array_offset = 0;
model->item_idx = 0;
return false;
});
string_set(browser->path, name);
string_set(browser->path, name);
}
archive_switch_dir(browser, string_get_cstr(browser->path));
}