Integrate all the progress into master #6

Merged
jaby merged 595 commits from ToolBox into main 2025-01-01 13:17:44 +00:00
1 changed files with 23 additions and 1 deletions
Showing only changes of commit 8840ca9147 - Show all commits

View File

@ -266,12 +266,34 @@ impl ConsoleUI {
}
fn create_mem_gauge_from<'a>(section_info: &SectionInfo, color: Color) -> Gauge<'a> {
const PERCISION:usize = 5;
const FLOAT_DISPLAY_LIMIT:f64 = {
let mut base = 1.0f64;
let mut i = 0;
while i < PERCISION {
base = base/10.0f64;
i += 1;
}
base
};
let adr_ratio = section_info.get_size_ratio();
Gauge::default().block(Block::default().borders(Borders::ALL)
.title(format!("{} @0x{:x} - 0x{:x} [{}b/{}b]",
section_info.name, section_info.start_adr, section_info.get_end_adr(), section_info.size, section_info.max_size)))
.gauge_style(Style::default().fg(color).bg(Color::Black).add_modifier(Modifier::BOLD))
.ratio(adr_ratio).label(format!("{}%", adr_ratio*100.0f64))
.ratio(adr_ratio).label({
let adr_ratio = adr_ratio*100.0f64;
if adr_ratio > FLOAT_DISPLAY_LIMIT {
format!("{:.width$}%", adr_ratio, width=PERCISION)
}
else {
format!("< {:.width$}%", FLOAT_DISPLAY_LIMIT, width=PERCISION)
}
})
}
fn create_exit_message<'a>() -> Paragraph<'a> {