aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-07-14 19:21:45 +0200
committerGitHub <noreply@github.com>2020-07-14 19:21:45 +0200
commitb4158dbd9e7904ffe0cc9f068b5e9b5fb1f5e188 (patch)
tree11ddad2f7475a61d0ff141c0ec0cf6d291997449
parent47b12555611d515f922c2017e77d1dac80df5bd3 (diff)
parent54d4307a2e065ed41f4ee786805e1830fce5e320 (diff)
downloadgit-bug-b4158dbd9e7904ffe0cc9f068b5e9b5fb1f5e188.tar.gz
Merge pull request #427 from wavexx/trim_titles
Trim titles in list views
-rw-r--r--commands/ls.go4
-rw-r--r--termui/bug_table.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/commands/ls.go b/commands/ls.go
index 950e2aa0..4431e0d4 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -209,7 +209,7 @@ func lsDefaultFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
// truncate + pad if needed
labelsFmt := text.TruncateMax(labelsTxt.String(), 10)
- titleFmt := text.LeftPadMaxLine(b.Title, 50-text.Len(labelsFmt), 0)
+ titleFmt := text.LeftPadMaxLine(strings.TrimSpace(b.Title), 50-text.Len(labelsFmt), 0)
authorFmt := text.LeftPadMaxLine(name, 15, 0)
comments := fmt.Sprintf("%4d 💬", b.LenComments)
@@ -230,7 +230,7 @@ func lsDefaultFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
func lsPlainFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
for _, b := range bugExcerpts {
- env.out.Printf("%s [%s] %s\n", b.Id.Human(), b.Status, b.Title)
+ env.out.Printf("%s [%s] %s\n", b.Id.Human(), b.Status, strings.TrimSpace(b.Title))
}
return nil
}
diff --git a/termui/bug_table.go b/termui/bug_table.go
index e57a2b15..c02570db 100644
--- a/termui/bug_table.go
+++ b/termui/bug_table.go
@@ -319,7 +319,7 @@ func (bt *bugTable) render(v *gocui.View, maxX int) {
id := text.LeftPadMaxLine(excerpt.Id.Human(), columnWidths["id"], 1)
status := text.LeftPadMaxLine(excerpt.Status.String(), columnWidths["status"], 1)
labels := text.TruncateMax(labelsTxt.String(), minInt(columnWidths["title"]-2, 10))
- title := text.LeftPadMaxLine(excerpt.Title, columnWidths["title"]-text.Len(labels), 1)
+ title := text.LeftPadMaxLine(strings.TrimSpace(excerpt.Title), columnWidths["title"]-text.Len(labels), 1)
author := text.LeftPadMaxLine(authorDisplayName, columnWidths["author"], 1)
comments := text.LeftPadMaxLine(summaryTxt, columnWidths["comments"], 1)
lastEdit := text.LeftPadMaxLine(humanize.Time(lastEditTime), columnWidths["lastEdit"], 1)