From b5de2cd666563a5d4f25dd277136daf74885f447 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sat, 12 Feb 2022 12:54:11 +0300 Subject: [PATCH] cleanup cc #751 --- eval.go | 2 -- opts.go | 2 -- ui.go | 6 +++--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/eval.go b/eval.go index 0ad2595..abd2249 100644 --- a/eval.go +++ b/eval.go @@ -420,10 +420,8 @@ func (e *setExpr) eval(app *app, args []string) { gOpts.timefmt = e.val case "infotimefmtnew": gOpts.infotimefmtnew = e.val - gInfotimefmtMaxLen = max(len(gOpts.infotimefmtnew), len(gOpts.infotimefmtold)) case "infotimefmtold": gOpts.infotimefmtold = e.val - gInfotimefmtMaxLen = max(len(gOpts.infotimefmtnew), len(gOpts.infotimefmtold)) case "truncatechar": if runeSliceWidth([]rune(e.val)) != 1 { app.ui.echoerr("truncatechar: value should be a single character") diff --git a/opts.go b/opts.go index 10917b3..514820d 100644 --- a/opts.go +++ b/opts.go @@ -76,8 +76,6 @@ var gOpts struct { tempmarks string } -var gInfotimefmtMaxLen = 12 - func init() { gOpts.anchorfind = true gOpts.autoquit = false diff --git a/ui.go b/ui.go index e30f791..7b28489 100644 --- a/ui.go +++ b/ui.go @@ -328,11 +328,11 @@ func fileInfo(f *file, d *dir) string { info = fmt.Sprintf("%s 999+", info) } case "time": - info = fmt.Sprintf(fmt.Sprint("%"+"s %", gInfotimefmtMaxLen, "s"), info, infotimefmt(f.ModTime())) + info = fmt.Sprintf("%s %*s", info, max(len(gOpts.infotimefmtnew), len(gOpts.infotimefmtold)), infotimefmt(f.ModTime())) case "atime": - info = fmt.Sprintf(fmt.Sprint("%"+"s %", gInfotimefmtMaxLen, "s"), info, infotimefmt(f.accessTime)) + info = fmt.Sprintf("%s %*s", info, max(len(gOpts.infotimefmtnew), len(gOpts.infotimefmtold)), infotimefmt(f.accessTime)) case "ctime": - info = fmt.Sprintf(fmt.Sprint("%"+"s %", gInfotimefmtMaxLen, "s"), info, infotimefmt(f.changeTime)) + info = fmt.Sprintf("%s %*s", info, max(len(gOpts.infotimefmtnew), len(gOpts.infotimefmtold)), infotimefmt(f.changeTime)) default: log.Printf("unknown info type: %s", s) }