cc #751
This commit is contained in:
Gokcehan 2022-02-12 12:54:11 +03:00
parent 73f990cdb6
commit b5de2cd666
3 changed files with 3 additions and 7 deletions

View File

@ -420,10 +420,8 @@ func (e *setExpr) eval(app *app, args []string) {
gOpts.timefmt = e.val gOpts.timefmt = e.val
case "infotimefmtnew": case "infotimefmtnew":
gOpts.infotimefmtnew = e.val gOpts.infotimefmtnew = e.val
gInfotimefmtMaxLen = max(len(gOpts.infotimefmtnew), len(gOpts.infotimefmtold))
case "infotimefmtold": case "infotimefmtold":
gOpts.infotimefmtold = e.val gOpts.infotimefmtold = e.val
gInfotimefmtMaxLen = max(len(gOpts.infotimefmtnew), len(gOpts.infotimefmtold))
case "truncatechar": case "truncatechar":
if runeSliceWidth([]rune(e.val)) != 1 { if runeSliceWidth([]rune(e.val)) != 1 {
app.ui.echoerr("truncatechar: value should be a single character") app.ui.echoerr("truncatechar: value should be a single character")

View File

@ -76,8 +76,6 @@ var gOpts struct {
tempmarks string tempmarks string
} }
var gInfotimefmtMaxLen = 12
func init() { func init() {
gOpts.anchorfind = true gOpts.anchorfind = true
gOpts.autoquit = false gOpts.autoquit = false

6
ui.go
View File

@ -328,11 +328,11 @@ func fileInfo(f *file, d *dir) string {
info = fmt.Sprintf("%s 999+", info) info = fmt.Sprintf("%s 999+", info)
} }
case "time": 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": 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": 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: default:
log.Printf("unknown info type: %s", s) log.Printf("unknown info type: %s", s)
} }