fix(cli): flex-col min-width clamping and formatting consistency

- render.rs: clamp flex column width to min(min_flex, natural) instead
  of a hardcoded 20, preventing layout overflow when natural width is
  small; rewrites flex_width test to be terminal-independent
- list/issues.rs: adopt .flex_col() builder on table construction
- list/mrs.rs, list/notes.rs: consolidate multi-line StyledCell::styled
  calls to single-line format
- explain.rs: adopt flex_width() for related-issue title truncation,
  consolidate multi-line formatting
This commit is contained in:
teernisse
2026-03-13 11:13:33 -04:00
parent cebafe0213
commit 20753608e8
5 changed files with 44 additions and 36 deletions

View File

@@ -1137,7 +1137,11 @@ pub fn print_explain(result: &ExplainResult) {
// Entity header
let (type_label, ref_style, ref_str) = match result.entity.entity_type.as_str() {
"issue" => ("Issue", Theme::issue_ref(), format!("#{}", result.entity.iid)),
"issue" => (
"Issue",
Theme::issue_ref(),
format!("#{}", result.entity.iid),
),
"merge_request" => ("MR", Theme::mr_ref(), format!("!{}", result.entity.iid)),
_ => (
result.entity.entity_type.as_str(),
@@ -1246,8 +1250,10 @@ pub fn print_explain(result: &ExplainResult) {
println!(
" {} by {} ({} notes, last: {})",
Theme::dim().render(&t.discussion_id),
Theme::username()
.render(&format!("@{}", t.started_by.as_deref().unwrap_or("unknown"))),
Theme::username().render(&format!(
"@{}",
t.started_by.as_deref().unwrap_or("unknown")
)),
t.note_count,
Theme::dim().render(&to_relative(&t.last_note_at))
);
@@ -1300,7 +1306,10 @@ pub fn print_explain(result: &ExplainResult) {
println!(
" {arrow} {} {}{state_str} ({})",
ref_style.render(&format!("{ref_prefix}{}", ri.iid)),
render::truncate(ri.title.as_deref().unwrap_or("(untitled)"), render::flex_width(30, 20)),
render::truncate(
ri.title.as_deref().unwrap_or("(untitled)"),
render::flex_width(30, 20)
),
Theme::dim().render(&ri.reference_type)
);
}