mirror of
https://gittea.dev/nova/th.git
synced 2026-01-30 08:40:10 -05:00
small changes
This commit is contained in:
3
dir.c
3
dir.c
@@ -254,7 +254,7 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
||||
file_name[printable_size + strlen(extension)-1] = '\0';
|
||||
file_name[printable_size - 2] = '~';
|
||||
} else {
|
||||
file_name = malloc(printable_size-1);
|
||||
file_name = malloc(printable_size);
|
||||
memcpy(file_name, dir_content[i].file_name, printable_size);
|
||||
file_name[printable_size-2] = '~';
|
||||
file_name[printable_size-1] = '\0';
|
||||
@@ -323,6 +323,7 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
||||
|
||||
char update_selected_file(){
|
||||
char ret = -1; /* -1 on empty or inaccessible file, 0 on unchanged file, 1 on changed file */
|
||||
|
||||
if (selected_file_current >= mid_file_count) {
|
||||
selected_file_current = mid_file_count-1;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ void move_up(unsigned long passes){
|
||||
current_dir->selected_file_current = selected_file_current;
|
||||
|
||||
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_0);
|
||||
pthread_mutex_unlock(&mutex_selection);
|
||||
}
|
||||
void move_left(unsigned long passes){
|
||||
@@ -217,7 +217,9 @@ void move_left(unsigned long passes){
|
||||
selected_file_current = dir_get_selected_file_current();
|
||||
}
|
||||
}
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
|
||||
update_selected_file();
|
||||
current_dir->selected_file_current = selected_file_current;
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_RELOAD_FULL | STATUS_RELOAD_DIRECTORY);
|
||||
}
|
||||
void move_right(){
|
||||
if (mid_content->file_name[0] == '\0') {
|
||||
@@ -248,7 +250,7 @@ void move_right(){
|
||||
}
|
||||
curs_set(1); /*for some reason, 1 here turns it invisible once again */
|
||||
match = 1;
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_RELOAD_FULL | STATUS_RELOAD_DIRECTORY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -262,7 +264,7 @@ void move_right(){
|
||||
/*do nothing*/
|
||||
}
|
||||
curs_set(1); /*for some reason, 1 here turns it invisible once again */
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_RELOAD_FULL | STATUS_RELOAD_DIRECTORY);
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -271,11 +273,11 @@ void move_right(){
|
||||
free(mime);
|
||||
}
|
||||
update_selected_file();
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_RELOAD_FULL | STATUS_RELOAD_DIRECTORY);
|
||||
}
|
||||
void toggle_hidden_files(){
|
||||
file_modifiers ^= FILE_MODIFIERS_HIDDEN_FILES;
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_RELOAD_FULL | STATUS_RELOAD_DIRECTORY);
|
||||
}
|
||||
void toggle_selection(){
|
||||
pthread_mutex_lock(&mutex_selection);
|
||||
@@ -291,7 +293,7 @@ void jump_bottom(){
|
||||
selected_file_current = 0 - 1;
|
||||
update_selected_file();
|
||||
current_dir->selected_file_current = selected_file_current;
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
|
||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_0);
|
||||
pthread_mutex_unlock(&mutex_selection);
|
||||
}
|
||||
void jump_top(){
|
||||
|
||||
16
threading.c
16
threading.c
@@ -93,9 +93,7 @@ void *thread_mid(){
|
||||
mid_file_count = 0;
|
||||
|
||||
}
|
||||
pthread_mutex_lock(&mutex_selection);
|
||||
update_selected_file();
|
||||
pthread_mutex_unlock(&mutex_selection);
|
||||
}
|
||||
|
||||
btm_status = local_status;
|
||||
@@ -157,18 +155,11 @@ void *thread_rgt(){
|
||||
|
||||
|
||||
pthread_mutex_lock(&mutex_mid);
|
||||
char *path;
|
||||
if (mid_file_count != 0) {
|
||||
path = malloc(strlen(mid_content[selected_file_current].file_name) + 1);
|
||||
memcpy(path, mid_content[selected_file_current].file_name, strlen(mid_content[selected_file_current].file_name)+1);
|
||||
} else {
|
||||
path = malloc(sizeof(char));
|
||||
path[0] = '\0';
|
||||
}
|
||||
char *path = mid_content[selected_file_current].file_name;
|
||||
memcpy(&file_current, &mid_content[selected_file_current], sizeof(file));
|
||||
pthread_mutex_unlock(&mutex_mid);
|
||||
|
||||
if (mid_content[selected_file_current].permissions & S_IRUSR) {
|
||||
if (file_current.permissions & S_IRUSR) {
|
||||
if (file_current.file_type &= FILE_TYPE_DIR) {
|
||||
#if SETTINGS_UEBERZUG_IMAGE_PREVIEW != 0
|
||||
images_clear();
|
||||
@@ -229,8 +220,9 @@ void *thread_rgt(){
|
||||
rgt_buffer = malloc(sizeof(char));
|
||||
rgt_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
free(path);
|
||||
*/
|
||||
|
||||
pthread_mutex_unlock(&mutex_rgt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user