mirror of
https://gittea.dev/nova/th.git
synced 2025-10-21 10:20:15 -04:00
relative line numbers now show the index of the current file
This commit is contained in:
13
dir.c
13
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);
|
||||
|
||||
|
Reference in New Issue
Block a user