parent
a3714bf8e4
commit
1f3880f32e
2
go.mod
2
go.mod
@ -7,3 +7,5 @@ require (
|
||||
github.com/nsf/termbox-go v0.0.0-20180819125858-b66b20ab708e
|
||||
golang.org/x/sys v0.0.0-20191002091554-b397fe3ad8ed // indirect
|
||||
)
|
||||
|
||||
go 1.13
|
||||
|
@ -587,22 +587,22 @@ func (screen *BrowserScreen) drawRightPane(style Style) {
|
||||
startY := 2
|
||||
if err == nil {
|
||||
if b != nil {
|
||||
pathString := fmt.Sprintf("Path: %s", strings.Join(b.GetPath(), " → "))
|
||||
pathString := fmt.Sprintf("Path: %s", strings.Join(stringifyPath(b.GetPath()), " → "))
|
||||
startY += screen.drawMultilineText(pathString, 6, startX, startY, (w/2)-1, style.defaultFg, style.defaultBg)
|
||||
bucketString := fmt.Sprintf("Buckets: %d", len(b.buckets))
|
||||
startY += screen.drawMultilineText(bucketString, 9, startX, startY, (w/2)-1, style.defaultFg, style.defaultBg)
|
||||
pairsString := fmt.Sprintf("Pairs: %d", len(b.pairs))
|
||||
startY += screen.drawMultilineText(pairsString, 7, startX, startY, (w/2)-1, style.defaultFg, style.defaultBg)
|
||||
} else if p != nil {
|
||||
pathString := fmt.Sprintf("Path: %s", strings.Join(p.GetPath(), " → "))
|
||||
pathString := fmt.Sprintf("Path: %s", strings.Join(stringifyPath(p.GetPath()), " → "))
|
||||
startY += screen.drawMultilineText(pathString, 6, startX, startY, (w/2)-1, style.defaultFg, style.defaultBg)
|
||||
keyString := fmt.Sprintf("Key: %s", stringify([]byte(p.key)))
|
||||
startY += screen.drawMultilineText(keyString, 5, startX, startY, (w/2)-1, style.defaultFg, style.defaultBg)
|
||||
valString := fmt.Sprintf("Value: %s", formatValue([]byte(p.val)))
|
||||
valString := fmt.Sprintf("Value: %s", stringify(formatValue([]byte(p.val))))
|
||||
startY += screen.drawMultilineText(valString, 7, startX, startY, (w/2)-1, style.defaultFg, style.defaultBg)
|
||||
}
|
||||
} else {
|
||||
pathString := fmt.Sprintf("Path: %s", strings.Join(screen.currentPath, " → "))
|
||||
pathString := fmt.Sprintf("Path: %s", strings.Join(stringifyPath(screen.currentPath), " → "))
|
||||
startY += screen.drawMultilineText(pathString, 6, startX, startY, (w/2)-1, style.defaultFg, style.defaultBg)
|
||||
startY += screen.drawMultilineText(err.Error(), 6, startX, startY, (w/2)-1, style.defaultFg, style.defaultBg)
|
||||
}
|
||||
@ -657,7 +657,7 @@ func (screen *BrowserScreen) drawBucket(bkt *BoltBucket, style Style, y int) int
|
||||
|
||||
padAmt := (len(bkt.GetPath())*2 + 2)
|
||||
if bkt.expanded {
|
||||
bktString = bktString + "- " + bkt.name
|
||||
bktString = bktString + "- " + stringify([]byte(bkt.name))
|
||||
if len(bktString)+padAmt > w {
|
||||
bktString = bktString[:w-padAmt-3] + "..."
|
||||
}
|
||||
@ -670,7 +670,7 @@ func (screen *BrowserScreen) drawBucket(bkt *BoltBucket, style Style, y int) int
|
||||
usedLines += screen.drawPair(&bkt.pairs[i], style, y+usedLines)
|
||||
}
|
||||
} else {
|
||||
bktString = bktString + "+ " + bkt.name
|
||||
bktString = bktString + "+ " + stringify([]byte(bkt.name))
|
||||
if len(bktString)+padAmt > w {
|
||||
bktString = bktString[:w-padAmt-3] + "..."
|
||||
}
|
||||
|
@ -30,3 +30,10 @@ func stringify(v []byte) string {
|
||||
|
||||
return fmt.Sprintf("%x", v)
|
||||
}
|
||||
|
||||
func stringifyPath(path []string) []string {
|
||||
for k, v := range path {
|
||||
path[k] = stringify([]byte(v))
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user