fixed some stabillity issues and memory leaks
This commit is contained in:
@@ -167,7 +167,7 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
||||
if (*dir_file_count > 9) {
|
||||
offset_front = (snprintf(NULL, 0, "%ld", *dir_file_count)) + 1;
|
||||
}
|
||||
if (selected_file_current > (terminal_height/3)*2) {
|
||||
if (selected_file_current > (terminal_height/3)*2 && *dir_file_count > terminal_height - 2) {
|
||||
if (selected_file_current + (terminal_height/3) >= *dir_file_count) {
|
||||
offset_vertical = *dir_file_count - terminal_height+2;
|
||||
} else {
|
||||
@@ -247,9 +247,9 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
||||
}
|
||||
|
||||
mvwaddstr(win, i-offset_vertical, 0, bg);
|
||||
mvwaddnstr(win, i-offset_vertical, offset_front+is_selected, file_name, line_width-offset_front-is_selected-2);
|
||||
if(print_info) {
|
||||
mvwprintw(win, i-offset_vertical, 0, "%ld", i);
|
||||
mvwaddnstr(win, i-offset_vertical, offset_front+is_selected, file_name, line_width-offset_front-is_selected-2);
|
||||
free(file_name);
|
||||
|
||||
if (dir_content[i].file_type == FILE_TYPE_DIR || dir_content[i].file_type == FILE_TYPE_SYMLINK) {
|
||||
|
Reference in New Issue
Block a user