now accounting for root dir
This commit is contained in:
+17
-6
@@ -304,9 +304,13 @@ void *thread_top(){
|
|||||||
if (mid_dir.current_file != NULL) {
|
if (mid_dir.current_file != NULL) {
|
||||||
top_buffer = malloc(strlen(global_path)+1 + strlen(mid_dir.current_file->file_name)+1);
|
top_buffer = malloc(strlen(global_path)+1 + strlen(mid_dir.current_file->file_name)+1);
|
||||||
memcpy(top_buffer, global_path, strlen(global_path));
|
memcpy(top_buffer, global_path, strlen(global_path));
|
||||||
memcpy(top_buffer + strlen(global_path) + 1, mid_dir.current_file->file_name, strlen(mid_dir.current_file->file_name)+1);
|
if (strlen(global_path) != 1) {
|
||||||
|
memcpy(top_buffer + strlen(global_path) + 1, mid_dir.current_file->file_name, strlen(mid_dir.current_file->file_name)+1);
|
||||||
|
top_buffer[strlen(global_path)] = '/';
|
||||||
|
} else { /* dir '/' */
|
||||||
|
memcpy(top_buffer + 1, mid_dir.current_file->file_name, strlen(mid_dir.current_file->file_name)+1);
|
||||||
|
}
|
||||||
|
|
||||||
top_buffer[strlen(global_path)] = '/';
|
|
||||||
top_width = strlen(top_buffer);
|
top_width = strlen(top_buffer);
|
||||||
} else {
|
} else {
|
||||||
top_buffer = malloc(strlen(global_path)+1);
|
top_buffer = malloc(strlen(global_path)+1);
|
||||||
@@ -318,10 +322,17 @@ void *thread_top(){
|
|||||||
/* rendering */
|
/* rendering */
|
||||||
pthread_mutex_lock(&mutex_render);
|
pthread_mutex_lock(&mutex_render);
|
||||||
werase(win_t);
|
werase(win_t);
|
||||||
wattron(win_t, COLOR_PAIR(COLOR_PATH));
|
if (strlen(global_path) != 1) {
|
||||||
mvwaddnstr(win_t, 0, 0, top_buffer, strlen(global_path)+1);
|
wattron(win_t, COLOR_PAIR(COLOR_PATH));
|
||||||
wattroff(win_t, COLOR_PAIR(COLOR_PATH));
|
mvwaddnstr(win_t, 0, 0, top_buffer, strlen(global_path)+1);
|
||||||
mvwaddstr(win_t, 0, strlen(global_path)+1, top_buffer+strlen(global_path)+1);
|
wattroff(win_t, COLOR_PAIR(COLOR_PATH));
|
||||||
|
mvwaddstr(win_t, 0, strlen(global_path)+1, top_buffer+strlen(global_path)+1);
|
||||||
|
} else { /* dir '/' */
|
||||||
|
wattron(win_t, COLOR_PAIR(COLOR_PATH));
|
||||||
|
mvwaddnstr(win_t, 0, 0, top_buffer, 1);
|
||||||
|
wattroff(win_t, COLOR_PAIR(COLOR_PATH));
|
||||||
|
mvwaddstr(win_t, 0, 1, top_buffer+1);
|
||||||
|
}
|
||||||
/*wnoutrefresh(win_t);*/
|
/*wnoutrefresh(win_t);*/
|
||||||
wrefresh(win_t);
|
wrefresh(win_t);
|
||||||
pthread_mutex_unlock(&mutex_render);
|
pthread_mutex_unlock(&mutex_render);
|
||||||
|
|||||||
Reference in New Issue
Block a user