scrolling limit
This commit is contained in:
19
backend.c
19
backend.c
@@ -162,11 +162,17 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
||||
unsigned long offset_vertical = 0;
|
||||
unsigned long offset_back = 0;
|
||||
unsigned long offset_front = 2;
|
||||
if (*dir_file_count > 9) {
|
||||
offset_front = (snprintf(NULL, 0, "%ld", *dir_file_count)) + 1;
|
||||
}
|
||||
if (selected_file_current > (terminal_height/3)*2 && print_info) {
|
||||
offset_vertical = selected_file_current - (terminal_height/3)*2;
|
||||
if (print_info) {
|
||||
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) >= *dir_file_count) {
|
||||
offset_vertical = *dir_file_count - terminal_height+2;
|
||||
} else {
|
||||
offset_vertical = selected_file_current - (terminal_height/3)*2;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = offset_vertical; i < *dir_file_count && i < (terminal_height + offset_vertical); i++) {
|
||||
if (print_info) {
|
||||
@@ -196,7 +202,6 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
||||
is_selected = 0;
|
||||
}
|
||||
|
||||
mvwaddnstr(win, i, 0, bg, offset_front+is_selected);
|
||||
if (dir_content[i].status & FILE_STATUS_SELECTED) {
|
||||
wattron(win, COLOR_PAIR(8));
|
||||
} else {
|
||||
@@ -241,9 +246,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) {
|
||||
|
@@ -102,8 +102,8 @@ void *thread_mid(void *data){
|
||||
mid_content[selected_file_last].status &= ~FILE_STATUS_HOVER;
|
||||
}
|
||||
selected_file_last = selected_file_current;
|
||||
free(file_current->file_name);
|
||||
|
||||
free(file_current->file_name);
|
||||
file_current->file_name = malloc(strlen(mid_content[selected_file_current].file_name));
|
||||
strcpy(file_current->file_name, mid_content[selected_file_current].file_name);
|
||||
file_current->file_size = mid_content[selected_file_current].file_size;
|
||||
|
Reference in New Issue
Block a user