From a9e6ae663dbad585cb0b35022aaa851bd7dc2860 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Fri, 23 Feb 2024 21:44:03 +0100 Subject: [PATCH] alignments and formats --- internal/navigator/navigator.go | 3 ++- internal/node/storage.go | 6 +++--- internal/stringer/attrs.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/navigator/navigator.go b/internal/navigator/navigator.go index 2c85a81..8f4c7f6 100644 --- a/internal/navigator/navigator.go +++ b/internal/navigator/navigator.go @@ -87,7 +87,7 @@ func (a *Navigator) eventHandler(eventKey *tcell.EventKey) *tcell.EventKey { a.selectedFlag = true a.app.Stop() return nil - } else if eventKey.Rune() == 'h' || eventKey.Key() == tcell.KeyLeft { + } else if eventKey.Rune() == 'h' || eventKey.Key() == tcell.KeyLeft || eventKey.Key() == tcell.KeyBackspace2 { // open parent directory a.goBackFlag = true a.app.Stop() @@ -99,6 +99,7 @@ func (a *Navigator) eventHandler(eventKey *tcell.EventKey) *tcell.EventKey { a.app.Stop() return nil } else if eventKey.Rune() == 'L' { + // toggle long mode a.longMode = !a.longMode a.reloadFlag = true a.app.Stop() diff --git a/internal/node/storage.go b/internal/node/storage.go index 729e2fd..c4acf4b 100644 --- a/internal/node/storage.go +++ b/internal/node/storage.go @@ -137,14 +137,14 @@ func (n *StorageNode) GetAttr(rawSize bool, long bool) map[string]string { attrs["nbfiles"] = fmt.Sprintf("%d", n.TotalFiles) attrs["size"] = sizeToString(n.Size, rawSize) total := sizeToString(n.Total, rawSize) - attrs["fs_size"] = total + attrs["fs_size"] = fmt.Sprintf("%-6s", total) freePercent := "??" if n.Total != 0 { freePercent = fmt.Sprintf("%d%%", n.Free*100/n.Total) } - attrs["fs_free"] = freePercent + attrs["fs_free"] = fmt.Sprintf("%3s", freePercent) used := sizeToString(n.Total-n.Free, rawSize) - attrs["fs_du"] = fmt.Sprintf("%s/%s", used, total) + attrs["fs_du"] = fmt.Sprintf("%6s/%6s", used, total) attrs["indexed"] = utils.DateToString(n.IndexedAt) attrs["meta"] = n.Meta diff --git a/internal/stringer/attrs.go b/internal/stringer/attrs.go index 5fd1132..9af7e48 100644 --- a/internal/stringer/attrs.go +++ b/internal/stringer/attrs.go @@ -29,7 +29,7 @@ func attrToStringColored(key string, value string, cm *colorme.ColorMe) string { } else if key == "mode" { line = cm.InYellow(value) } else if key == "size" { - line = cm.InGreen(fmt.Sprintf("%-6s", value)) + line = cm.InGreen(fmt.Sprintf("%6s", value)) } else if key == "type" { line = cm.InRed(fmt.Sprintf("%-4s", value)) } else {