From 8839f737c5fbb9608ac5a83ed89ce3f306bb61cd Mon Sep 17 00:00:00 2001 From: nova Date: Mon, 29 Sep 2025 19:29:31 +0200 Subject: [PATCH] addded select_all --- config.h | 1 + interactions.c | 10 ++++++++++ interactions.h | 1 + 3 files changed, 12 insertions(+) diff --git a/config.h b/config.h index 5205ba9..bef9784 100644 --- a/config.h +++ b/config.h @@ -44,6 +44,7 @@ static const binding key_binding[] = { /* blackmagic holds a modifier of an action, either as string or as function pointer depending on the action */ { "q", quit_program, NULL, "quit" }, { " ", toggle_selection, NULL, "toggle file selection" }, /* on hovered file/directory */ + { "v", select_all, NULL, "select all files in dir" }, { "e", update, NULL, "rerun all backend" }, /* executes the entire backend and redrawing of the screen */ { "B", enter_shell, "$SHELL", "enter $SHELL shell" }, { "/", search, NULL, "search" }, diff --git a/interactions.c b/interactions.c index abaf795..885283b 100644 --- a/interactions.c +++ b/interactions.c @@ -194,6 +194,16 @@ void toggle_selection(){ pthread_mutex_unlock(&mutex_mid); pthread_mutex_unlock(&mutex_selection); } +void select_all(){ + pthread_mutex_lock(&mutex_selection); + pthread_mutex_lock(&mutex_mid); + unsigned long i; + for(i = 0; i < mid_file_count; i++) { + mid_content[i].status ^= FILE_STATUS_SELECTED; + } + pthread_mutex_unlock(&mutex_mid); + pthread_mutex_unlock(&mutex_selection); +} void move_down(int passes){ pthread_mutex_lock(&mutex_selection); if (passes == 0) { diff --git a/interactions.h b/interactions.h index 5274649..355964f 100644 --- a/interactions.h +++ b/interactions.h @@ -7,6 +7,7 @@ void user_interactions(); void quit_program(); void toggle_selection(); +void select_all(); void move_right(); void move_up(int passes); void move_down(int passes);