diff --git a/src/cli/commands/show.rs b/src/cli/commands/show.rs index edc65a0..c680270 100644 --- a/src/cli/commands/show.rs +++ b/src/cli/commands/show.rs @@ -556,15 +556,6 @@ fn format_date(ms: i64) -> String { iso.split('T').next().unwrap_or(&iso).to_string() } -fn truncate(s: &str, max_len: usize) -> String { - if s.chars().count() <= max_len { - s.to_string() - } else { - let truncated: String = s.chars().take(max_len.saturating_sub(3)).collect(); - format!("{truncated}...") - } -} - fn wrap_text(text: &str, width: usize, indent: &str) -> String { let mut result = String::new(); let mut current_line = String::new(); @@ -671,8 +662,7 @@ pub fn print_show_issue(issue: &IssueDetail) { println!("{}", style("Description:").bold()); if let Some(desc) = &issue.description { - let truncated = truncate(desc, 500); - let wrapped = wrap_text(&truncated, 76, " "); + let wrapped = wrap_text(desc, 76, " "); println!(" {}", wrapped); } else { println!(" {}", style("(no description)").dim()); @@ -705,7 +695,7 @@ pub fn print_show_issue(issue: &IssueDetail) { style(format!("@{}", first_note.author_username)).cyan(), format_date(first_note.created_at) ); - let wrapped = wrap_text(&truncate(&first_note.body, 300), 72, " "); + let wrapped = wrap_text(&first_note.body, 72, " "); println!(" {}", wrapped); println!(); @@ -715,7 +705,7 @@ pub fn print_show_issue(issue: &IssueDetail) { style(format!("@{}", reply.author_username)).cyan(), format_date(reply.created_at) ); - let wrapped = wrap_text(&truncate(&reply.body, 300), 68, " "); + let wrapped = wrap_text(&reply.body, 68, " "); println!(" {}", wrapped); println!(); } @@ -796,8 +786,7 @@ pub fn print_show_mr(mr: &MrDetail) { println!("{}", style("Description:").bold()); if let Some(desc) = &mr.description { - let truncated = truncate(desc, 500); - let wrapped = wrap_text(&truncated, 76, " "); + let wrapped = wrap_text(desc, 76, " "); println!(" {}", wrapped); } else { println!(" {}", style("(no description)").dim()); @@ -834,7 +823,7 @@ pub fn print_show_mr(mr: &MrDetail) { style(format!("@{}", first_note.author_username)).cyan(), format_date(first_note.created_at) ); - let wrapped = wrap_text(&truncate(&first_note.body, 300), 72, " "); + let wrapped = wrap_text(&first_note.body, 72, " "); println!(" {}", wrapped); println!(); @@ -844,7 +833,7 @@ pub fn print_show_mr(mr: &MrDetail) { style(format!("@{}", reply.author_username)).cyan(), format_date(reply.created_at) ); - let wrapped = wrap_text(&truncate(&reply.body, 300), 68, " "); + let wrapped = wrap_text(&reply.body, 68, " "); println!(" {}", wrapped); println!(); } @@ -1234,16 +1223,6 @@ mod tests { assert_eq!(result[1].iid, 8); } - #[test] - fn truncate_leaves_short_strings() { - assert_eq!(truncate("short", 10), "short"); - } - - #[test] - fn truncate_adds_ellipsis() { - assert_eq!(truncate("this is a long string", 10), "this is..."); - } - #[test] fn wrap_text_single_line() { assert_eq!(wrap_text("hello world", 80, " "), "hello world");