diff --git a/dir.c b/dir.c index 65715bc..2342e24 100644 --- a/dir.c +++ b/dir.c @@ -167,10 +167,10 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file #if SETTINGS_LINE_NUMBERS == 0 unsigned long offset_front = 0; #else - unsigned long offset_front = 2; + long offset_front = 2; #endif - unsigned long offset_index = 2; /* only used for the index of the file itself */ + long offset_index = 2; /* only used for the index of the file itself */ if (print_info) { if (*dir_file_count > 9) { @@ -269,7 +269,7 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file if(print_info) { #if SETTINGS_LINE_NUMBERS == 2 long i_ = (selected_file_current) - i; - offset_index = !((selected_file_current) - i); + offset_index = 0; while(i_) { offset_index++; i_ /= 10; @@ -277,6 +277,13 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file long relative_index = selected_file_current - i; if (relative_index < 0) { relative_index = relative_index * -1; + } else if (relative_index == 0) { + i_ = (selected_file_current != 0) ? (selected_file_current) : 1; + while(i_) { + offset_index++; + i_ /= 10; + } + relative_index = i; } mvwprintw(win, i-offset_vertical, offset_front-offset_index-1, "%ld", relative_index);