From c3f93d1f949acce24122f00e4ca55dce1e64ff76 Mon Sep 17 00:00:00 2001 From: 956MB Date: Wed, 15 Jan 2025 20:29:43 -0600 Subject: [PATCH] fix: allow deselect of all children in unselected folder - Using deselect (`left`) on a folder that itself wasn't selected but had selected children inside (any amount in any sub folders) would not deselect everything from that folder down. Meaning the steps to deselect a folders contents would be to select the folder itself with `right` then deselect with `left`, adding one unnecessary action to the process. --- .../archive/scenes/archive_scene_browser.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/applications/main/archive/scenes/archive_scene_browser.c b/applications/main/archive/scenes/archive_scene_browser.c index cf93ebe1b..3b7605c08 100644 --- a/applications/main/archive/scenes/archive_scene_browser.c +++ b/applications/main/archive/scenes/archive_scene_browser.c @@ -323,15 +323,19 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) { ArchiveBrowserViewModel * model, { ArchiveFile_t* current = archive_get_current_file(browser); - for(size_t i = 0; i < model->selected_count; i++) { - if(furi_string_cmp(model->selected_files[i], current->path) == 0) { - furi_string_free(model->selected_files[i]); - for(size_t j = i; j < model->selected_count - 1; j++) { - model->selected_files[j] = model->selected_files[j + 1]; + if(!current->selected && current->type == ArchiveFileTypeFolder) { + archive_deselect_children(model, furi_string_get_cstr(current->path)); + } else { + for(size_t i = 0; i < model->selected_count; i++) { + if(furi_string_cmp(model->selected_files[i], current->path) == 0) { + furi_string_free(model->selected_files[i]); + for(size_t j = i; j < model->selected_count - 1; j++) { + model->selected_files[j] = model->selected_files[j + 1]; + } + model->selected_count--; + current->selected = false; + break; } - model->selected_count--; - current->selected = false; - break; } } },