Truncate long bucket names

This commit is contained in:
Brian Buller 2016-12-29 12:43:10 -06:00
parent 8dba00b972
commit 6a2dc9f776
1 changed files with 7 additions and 0 deletions

View File

@ -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