term render: show pretty size

This commit is contained in:
silverweed 2024-07-26 16:14:48 +02:00
parent e22133d3f8
commit 1ae3d6b82b

View file

@ -53,15 +53,17 @@ String8 render_legend_to_string(Arena *arena, const Term_Viewer &viewer, const A
Byte_Range range = get_section_range(app, static_cast<Section_Id>(section)); Byte_Range range = get_section_range(app, static_cast<Section_Id>(section));
String8 s; String8 s;
if (range.len) if (range.len)
s = push_str8f(scratch.arena, "%s%20s %s0x%lX - 0x%lX [%lu B]\n", s = push_str8f(scratch.arena, "%s%20s %s0x%lX - 0x%lX [%s]\n",
color_str.c(), sec_name.c(), color_none.c(), color_str.c(), sec_name.c(), color_none.c(),
range.start, range.end(), range.len); range.start, range.end(), to_pretty_size(scratch.arena, range.len).c());
else if (section == Sec_Page) else if (section == Sec_Page)
s = push_str8f(scratch.arena, "%s%20s %s(%lu) [%lu B] \n", s = push_str8f(scratch.arena, "%s%20s %s(%lu) [%s] \n",
color_str.c(), sec_name.c(), color_none.c(), app.rndata.n_pages, app.rndata.tot_page_size); color_str.c(), sec_name.c(), color_none.c(), app.rndata.n_pages,
to_pretty_size(scratch.arena, app.rndata.tot_page_size).c());
else if (section == Sec_Page_List) else if (section == Sec_Page_List)
s = push_str8f(scratch.arena, "%s%20s %s(%lu) [%lu B]\n", s = push_str8f(scratch.arena, "%s%20s %s(%lu) [%s]\n",
color_str.c(), sec_name.c(), color_none.c(), app.rndata.n_cluster_groups, app.rndata.tot_page_list_size); color_str.c(), sec_name.c(), color_none.c(), app.rndata.n_cluster_groups,
to_pretty_size(scratch.arena, app.rndata.tot_page_list_size).c());
String8_Node *node = arena_push<String8_Node>(scratch.arena); String8_Node *node = arena_push<String8_Node>(scratch.arena);
node->str = s; node->str = s;
if (!tail) { if (!tail) {