Skip to content

Commit 240fca0

Browse files
authored
Merge pull request #10485 from gitbutlerapp/kv-branch-57
fix(display): truncate commit description safely to 72 chars by
2 parents 57f8602 + 32e3c4c commit 240fca0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/but/src/base/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ pub fn handle(cmd: &Subcommands, repo_path: &Path, json: bool) -> anyhow::Result
4242
println!(
4343
"\t{} {}",
4444
&commit.id[..7],
45-
&commit.description.to_string().replace('\n', " ")[..72]
45+
&commit
46+
.description
47+
.to_string()
48+
.replace('\n', " ")
49+
.chars()
50+
.take(72)
51+
.collect::<String>()
4652
);
4753
}
4854
let hidden_commits = base_branch.behind.saturating_sub(3);

0 commit comments

Comments
 (0)