fix(ui): prevent grid column overflow with proper truncation
Fix column header and cell text truncation to prevent overflow when text width equals column width. Changed truncate() calls to use cw.saturating_sub(1) instead of cw, ensuring at least one character of padding remains. Affected areas: - Column header labels (left-aligned) - Column header labels (right-aligned) - Cell values - Total/summary rows Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
This commit is contained in:
@ -218,7 +218,7 @@ impl<'a> GridWidget<'a> {
|
||||
buf.set_string(
|
||||
x,
|
||||
y,
|
||||
format!("{:<width$}", truncate(&label, cw), width = cw),
|
||||
format!("{:<width$}", truncate(&label, cw.saturating_sub(1)), width = cw),
|
||||
group_style,
|
||||
);
|
||||
}
|
||||
@ -260,7 +260,7 @@ impl<'a> GridWidget<'a> {
|
||||
buf.set_string(
|
||||
x,
|
||||
y,
|
||||
format!("{:>width$}", truncate(&label, cw), width = cw),
|
||||
format!("{:>width$}", truncate(&label, cw.saturating_sub(1)), width = cw),
|
||||
styled,
|
||||
);
|
||||
}
|
||||
@ -434,7 +434,11 @@ impl<'a> GridWidget<'a> {
|
||||
buf.set_string(
|
||||
x,
|
||||
y,
|
||||
format!("{:>width$}", truncate(&cell_str, cw), width = cw),
|
||||
format!(
|
||||
"{:>width$}",
|
||||
truncate(&cell_str, cw.saturating_sub(1)),
|
||||
width = cw
|
||||
),
|
||||
cell_style,
|
||||
);
|
||||
}
|
||||
@ -495,7 +499,11 @@ impl<'a> GridWidget<'a> {
|
||||
buf.set_string(
|
||||
x,
|
||||
y,
|
||||
format!("{:>width$}", truncate(&total_str, cw), width = cw),
|
||||
format!(
|
||||
"{:>width$}",
|
||||
truncate(&total_str, cw.saturating_sub(1)),
|
||||
width = cw
|
||||
),
|
||||
Style::default()
|
||||
.fg(Color::Yellow)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
|
||||
Reference in New Issue
Block a user