[FL-1917] Archive: fix duplicates in favorites (#749)

* Archive: fix last_offset usage when switching to another tab
* fix the fix
This commit is contained in:
its your bedtime 2021-10-07 12:41:30 +03:00 committed by GitHub
parent 5232d5daba
commit 1dd96419ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,9 @@ void archive_update_offset(ArchiveBrowserView* browser) {
if(array_size > 3 && model->idx >= array_size - 1) {
model->list_offset = model->idx - 3;
} else if(model->last_offset && model->last_offset != model->list_offset) {
} else if(
model->last_offset && model->last_offset != model->list_offset &&
model->tab_idx == model->last_tab) {
model->list_offset = model->last_offset;
model->last_offset = !model->last_offset;
} else if(model->list_offset < model->idx - bounds) {
@ -18,7 +20,6 @@ void archive_update_offset(ArchiveBrowserView* browser) {
} else if(model->list_offset > model->idx - bounds) {
model->list_offset = CLAMP(model->idx - 1, array_size - bounds, 0);
}
return true;
});
}