bg no longer as string, now also only on hovered
This commit is contained in:
15
dir.c
15
dir.c
@@ -148,10 +148,6 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
|||||||
/* i am not proud of this function */
|
/* i am not proud of this function */
|
||||||
unsigned long line_width = getmaxx(win);
|
unsigned long line_width = getmaxx(win);
|
||||||
|
|
||||||
char *bg = malloc(line_width+1);
|
|
||||||
memset(bg, ' ', line_width);
|
|
||||||
bg[line_width] = '\0';
|
|
||||||
|
|
||||||
unsigned long i = 0;
|
unsigned long i = 0;
|
||||||
float file_size;
|
float file_size;
|
||||||
float printed_size = 0;
|
float printed_size = 0;
|
||||||
@@ -226,12 +222,17 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
|||||||
}
|
}
|
||||||
if (dir_content[i].status & FILE_STATUS_HOVER) {
|
if (dir_content[i].status & FILE_STATUS_HOVER) {
|
||||||
wattron(win, A_REVERSE);
|
wattron(win, A_REVERSE);
|
||||||
|
unsigned long bg = 0;
|
||||||
|
for (bg = 0; bg < line_width; bg++) {
|
||||||
|
mvwaddch(win, i-offset_vertical, bg, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wattroff(win, A_REVERSE);
|
wattroff(win, A_REVERSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mvwaddstr(win, i-offset_vertical, 0, bg);
|
|
||||||
if(print_info) {
|
if(print_info) {
|
||||||
#if SETTINGS_LINE_NUMBERS == 2
|
#if SETTINGS_LINE_NUMBERS == 2
|
||||||
long i_ = (selected_file_current) - i;
|
long i_ = (selected_file_current) - i;
|
||||||
@@ -274,7 +275,7 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
|||||||
}
|
}
|
||||||
char *extension = strrchr(dir_content[i].file_name, '.');
|
char *extension = strrchr(dir_content[i].file_name, '.');
|
||||||
|
|
||||||
size_t printable_size = offset_back-offset_front-is_selected-2;
|
unsigned long printable_size = offset_back-offset_front-is_selected-2;
|
||||||
|
|
||||||
mvwaddnstr(win, i-offset_vertical, offset_front+is_selected, dir_content[i].file_name, printable_size);
|
mvwaddnstr(win, i-offset_vertical, offset_front+is_selected, dir_content[i].file_name, printable_size);
|
||||||
if (extension && printable_size <= strlen(dir_content[i].file_name)) {
|
if (extension && printable_size <= strlen(dir_content[i].file_name)) {
|
||||||
@@ -288,10 +289,8 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
|||||||
} else {
|
} else {
|
||||||
wattroff(win, COLOR_PAIR(dir_content[i].color_pair));
|
wattroff(win, COLOR_PAIR(dir_content[i].color_pair));
|
||||||
}
|
}
|
||||||
/*free(file_name);*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
free(bg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char update_selected_file(){
|
char update_selected_file(){
|
||||||
|
|||||||
Reference in New Issue
Block a user