From 6a2dc9f776f1473c906b829ea02652a5a5f3f12d Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Thu, 29 Dec 2016 12:43:10 -0600 Subject: [PATCH] Truncate long bucket names --- screen_browser.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/screen_browser.go b/screen_browser.go index f0c200a..a36c6c6 100644 --- a/screen_browser.go +++ b/screen_browser.go @@ -534,8 +534,12 @@ func (screen *BrowserScreen) drawBucket(bkt *BoltBucket, style Style, y int) int bktString := prefixSpaces prefixSpaces = prefixSpaces + " " + padAmt := (len(bkt.GetPath())*2 + 2) if bkt.expanded { bktString = bktString + "- " + bkt.name + if len(bktString)+padAmt > w { + bktString = bktString[:w-padAmt-3] + "..." + } usedLines = screen.drawMultilineText(bktString, (len(bkt.GetPath())*2 + 2), 0, y, (w - 1), bucketFg, bucketBg) for i := range bkt.buckets { @@ -546,6 +550,9 @@ func (screen *BrowserScreen) drawBucket(bkt *BoltBucket, style Style, y int) int } } else { bktString = bktString + "+ " + bkt.name + if len(bktString)+padAmt > w { + bktString = bktString[:w-padAmt-3] + "..." + } usedLines = screen.drawMultilineText(bktString, (len(bkt.GetPath())*2 + 2), 0, y, (w - 1), bucketFg, bucketBg) } return usedLines