aboutsummaryrefslogtreecommitdiffstats
path: root/termui
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-02 16:48:07 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-02 16:48:07 +0200
commit9488467c754230288934dde4a49b9046e658986c (patch)
tree89a3b0c85ec4171f3b2c388d3786a3e92e92c938 /termui
parentae1ed6c11f3ae5675c80f377dd7f3996b3d621d0 (diff)
downloadgit-bug-9488467c754230288934dde4a49b9046e658986c.tar.gz
termui: show the last edit in a dedicated column
Diffstat (limited to 'termui')
-rw-r--r--termui/bug_table.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/termui/bug_table.go b/termui/bug_table.go
index 55b451af..f300c422 100644
--- a/termui/bug_table.go
+++ b/termui/bug_table.go
@@ -5,6 +5,7 @@ import (
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/util"
+ "github.com/dustin/go-humanize"
"github.com/jroimartin/gocui"
)
@@ -243,11 +244,14 @@ func (bt *bugTable) getColumnWidths(maxX int) map[string]int {
m["id"] = 10
m["status"] = 8
- left := maxX - 4 - m["id"] - m["status"]
+ left := maxX - 5 - m["id"] - m["status"]
- m["summary"] = maxInt(30, left/3)
+ m["summary"] = maxInt(11, left/6)
left -= m["summary"]
+ m["lastEdit"] = maxInt(19, left/6)
+ left -= m["lastEdit"]
+
m["author"] = maxInt(left*2/5, 15)
m["title"] = maxInt(left-m["author"], 10)
@@ -270,8 +274,9 @@ func (bt *bugTable) render(v *gocui.View, maxX int) {
title := util.LeftPaddedString(snap.Title, columnWidths["title"], 2)
author := util.LeftPaddedString(person.Name, columnWidths["author"], 2)
summary := util.LeftPaddedString(snap.Summary(), columnWidths["summary"], 2)
+ lastEdit := util.LeftPaddedString(humanize.Time(snap.LastEdit()), columnWidths["lastEdit"], 2)
- fmt.Fprintf(v, "%s %s %s %s %s\n", id, status, title, author, summary)
+ fmt.Fprintf(v, "%s %s %s %s %s %s\n", id, status, title, author, summary, lastEdit)
}
}
@@ -283,9 +288,10 @@ func (bt *bugTable) renderHeader(v *gocui.View, maxX int) {
title := util.LeftPaddedString("TITLE", columnWidths["title"], 2)
author := util.LeftPaddedString("AUTHOR", columnWidths["author"], 2)
summary := util.LeftPaddedString("SUMMARY", columnWidths["summary"], 2)
+ lastEdit := util.LeftPaddedString("LAST EDIT", columnWidths["lastEdit"], 2)
fmt.Fprintf(v, "\n")
- fmt.Fprintf(v, "%s %s %s %s %s\n", id, status, title, author, summary)
+ fmt.Fprintf(v, "%s %s %s %s %s %s\n", id, status, title, author, summary, lastEdit)
}