added file previev

This commit is contained in:
nova
2025-06-02 22:53:08 +02:00
parent f7c1d34e05
commit 0053c7cb88
6 changed files with 73 additions and 28 deletions

View File

@ -9,6 +9,9 @@ extern unsigned int file_modifiers;
unsigned long selected_file_current;
unsigned long selected_file_last;
extern pthread_mutex_t mutex_selection;
extern file *mid_content;
extern file *lft_content;
extern file *rgt_content;
void user_interactions(char *input, unsigned int *status, unsigned int *settings) {
if (*input == 'q') {
@ -17,16 +20,16 @@ void user_interactions(char *input, unsigned int *status, unsigned int *settings
file_modifiers ^= FILE_MODIFIERS_HIDDEN_FILES;
} else if (*input == 'a') {
file_modifiers ^= FILE_MODIFIERS_HIDDEN_FILES;
*status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
*status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
} else if (*input == 'o') {
file_modifiers ^= FILE_MODIFIERS_SORT_BITMASK;
} else if (*input == 'e') {
file_modifiers ^= FILE_MODIFIERS_SORT_ALPHABETIC;
} else if (*input == 'u') {
*status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
*status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
} else if (*input == 'h') {
chdir("..");
*status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
*status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
} else if (*input == 't') {
pthread_mutex_lock(&mutex_selection);
/* capping the maximum file is done inside thread_mid */
@ -40,6 +43,9 @@ void user_interactions(char *input, unsigned int *status, unsigned int *settings
}
*status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
pthread_mutex_unlock(&mutex_selection);
} else if (*input == 's') {
chdir(mid_content[selected_file_current].file_name);
*status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
} else {
}
}