From a4dae290e24ac8323a55cfc5c389184e425005b9 Mon Sep 17 00:00:00 2001 From: its your bedtime <23366927+itsyourbedtime@users.noreply.github.com> Date: Fri, 10 Sep 2021 20:06:34 +0300 Subject: [PATCH] [FL-1803] Archive: fix update_offset logic #695 --- applications/archive/views/archive_main_view.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/applications/archive/views/archive_main_view.c b/applications/archive/views/archive_main_view.c index 826a7483..ab2e11d7 100644 --- a/applications/archive/views/archive_main_view.c +++ b/applications/archive/views/archive_main_view.c @@ -41,7 +41,6 @@ void archive_browser_set_callback( void update_offset(ArchiveMainView* main_view) { furi_assert(main_view); - with_view_model( main_view->view, (ArchiveMainViewModel * model) { size_t array_size = files_array_size(model->files); @@ -50,7 +49,7 @@ void update_offset(ArchiveMainView* main_view) { if(array_size > 3 && model->idx >= array_size - 1) { model->list_offset = model->idx - 3; } else if(model->list_offset < model->idx - bounds) { - model->list_offset = CLAMP(model->list_offset + 1, array_size - bounds, 0); + model->list_offset = CLAMP(model->idx - 2, array_size - bounds, 0); } else if(model->list_offset > model->idx - bounds) { model->list_offset = CLAMP(model->idx - 1, array_size - bounds, 0); }