Compare commits

..

2 Commits

Author SHA1 Message Date
nova
f53fd66d88 added printing of mid_content[selected_file_current].file_name in top ui 2026-02-04 22:20:00 +01:00
nova
7e4ae9bb84 remove now useless memcopy 2026-02-04 22:17:52 +01:00
3 changed files with 6 additions and 4 deletions

3
dir.c
View File

@@ -257,8 +257,7 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
file_name[printable_size - strlen(extension) - 2] = '~';
file_name[printable_size] = '\0';
} else {
memcpy(file_name + 1, dir_content[i].file_name, (printable_size - strlen(extension)) -1);
memcpy(file_name + (printable_size - strlen(extension)), extension, strlen(extension) - 2);
memcpy(file_name + 1, extension, printable_size - 1);
file_name[0] = '~';
file_name[printable_size-2] = '~';
file_name[printable_size-1] = '\0';

View File

@@ -246,6 +246,7 @@ void *thread_top(){
top_buffer = malloc(strlen(global_path)+1);
memcpy(top_buffer, global_path, strlen(global_path)+1);
top_width = strlen(top_buffer);
/*printing of mid_content[selected_file_current].file_name is done directly in window.c window_top()*/
pthread_mutex_unlock(&mutex_top);
}

View File

@@ -37,11 +37,13 @@ void window_top(WINDOW *win){
werase(win);
if (pthread_mutex_trylock(&mutex_top) == 0) {
wattron(win, COLOR_PAIR(COLOR_PATH));
if (*top_buffer != ' ') { /*printing ' ' (standard initialized value, see threading_init) makes valgrind throw a fuss*/
wattron(win, COLOR_PAIR(COLOR_PATH));
mvwaddstr(win, 0, 0, top_buffer);
mvwaddch(win, 0, strlen(top_buffer), '/');
wattroff(win, COLOR_PAIR(COLOR_PATH));
mvwaddstr(win, 0, strlen(top_buffer)+1, mid_content[selected_file_current].file_name);
}
wattroff(win, COLOR_PAIR(COLOR_PATH));
pthread_mutex_unlock(&mutex_top);
} else {
mvwaddstr(win, 0, terminal_width/2, "LOADING");