1
0
mirror of https://gittea.dev/nova/th.git synced 2025-10-21 18:30:15 -04:00

now printing left storage & related refactoring

This commit is contained in:
nova
2025-09-24 22:20:07 +02:00
parent 14948ba573
commit fb1af6d2d2
3 changed files with 53 additions and 12 deletions

16
dir.c
View File

@@ -12,6 +12,8 @@
#include "config.h"
extern file *mid_content;
extern unsigned long mid_file_count;
extern unsigned int settings;
extern unsigned int file_modifiers;
extern unsigned int color_count;
@@ -160,7 +162,6 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
float printed_size = 0;
char size_char = ' ';
char is_selected = 0;
static const char sizes[6] = { 'B', 'K', 'M', 'G', 'T', 'P' };
unsigned long offset_vertical = 0;
unsigned long offset_back = 0;
@@ -229,16 +230,15 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
if (print_info) {
file_size = dir_content[i].file_size;
char size_index = 0;
while (file_size > 1) {
char size_index = -1;
do {
printed_size=file_size;
file_size /= 1024;
size_index++;
if (size_index >= 6) {
break;
}
}
size_char = sizes[size_index-1];
} while (file_size > 1 && size_index < size_unit_count);
size_char = size_unit[(unsigned)size_index];
if (dir_content[i].file_type == FILE_TYPE_DIR || dir_content[i].file_type == FILE_TYPE_SYMLINK) {
offset_back = line_width - (snprintf(NULL,0,"%ld", dir_content[i].file_size) + 1);
} else if (size_char =='B') {