diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b60f551..6615d708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - A new server command `list` is added to print the IDs of all currently connected clients (#2314). - The `previewer` and `cleaner` scripts now have their `stderr` output logged (#2316). - A new option `mergeindicators` is added to reduce the gap before filenames, by merging tag and selection indicators into a single column (#2330). -- The `ruler` file now supports `.Stat.Extension`, `.Stat.AccessTime`, `.Stat.BirthTime`, `.Stat.ChangeTime` and `.Stat.CustomInfo` (#2329). +- The `ruler` file now supports `.Stat.Extension`, `.Stat.DirSize`, `.Stat.DirCount`, `.Stat.AccessTime`, `.Stat.BirthTime`, `.Stat.ChangeTime` and `.Stat.CustomInfo` (#2329,#2343). ### Fixed diff --git a/doc.md b/doc.md index 36e287c8..5385c9a3 100644 --- a/doc.md +++ b/doc.md @@ -2238,6 +2238,8 @@ The following data fields are exported: .Stat.Name string Name of the current file .Stat.Extension string Extension of the current file .Stat.Size uint64 Size of the current file + .Stat.DirSize *uint64 Total Size of the current directory if calculated via `calcdirsize` + .Stat.DirCount *uint64 Number of items in the current directory if `dircounts` option is enabled .Stat.Permissions string Permissions of the current file .Stat.ModTime string Last modified time of the current file (formatted based on the `timefmt` option) .Stat.AccessTime string Last access time of the current file (formatted based on the `timefmt` option) diff --git a/doc.txt b/doc.txt index a3c3131e..74c6f056 100644 --- a/doc.txt +++ b/doc.txt @@ -2512,6 +2512,8 @@ The following data fields are exported: .Stat.Name string Name of the current file .Stat.Extension string Extension of the current file .Stat.Size uint64 Size of the current file + .Stat.DirSize *uint64 Total Size of the current directory if calculated via `calcdirsize` + .Stat.DirCount *uint64 Number of items in the current directory if `dircounts` option is enabled .Stat.Permissions string Permissions of the current file .Stat.ModTime string Last modified time of the current file (formatted based on the `timefmt` option) .Stat.AccessTime string Last access time of the current file (formatted based on the `timefmt` option) diff --git a/lf.1 b/lf.1 index 8f28253b..6e0a7061 100644 --- a/lf.1 +++ b/lf.1 @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc 3.7.0.2 .\" -.TH "LF" "1" "2026\-01\-12" "r41" "DOCUMENTATION" +.TH "LF" "1" "2026\-01\-16" "r41" "DOCUMENTATION" .SH NAME lf \- terminal file manager .SH SYNOPSIS @@ -2548,6 +2548,8 @@ The following data fields are exported: \&.Stat.Name string Name of the current file \&.Stat.Extension string Extension of the current file \&.Stat.Size uint64 Size of the current file +\&.Stat.DirSize *uint64 Total Size of the current directory if calculated via \(gacalcdirsize\(ga +\&.Stat.DirCount *uint64 Number of items in the current directory if \(gadircounts\(ga option is enabled \&.Stat.Permissions string Permissions of the current file \&.Stat.ModTime string Last modified time of the current file (formatted based on the \(gatimefmt\(ga option) \&.Stat.AccessTime string Last access time of the current file (formatted based on the \(gatimefmt\(ga option) diff --git a/ruler.go b/ruler.go index 19755a30..930a1473 100644 --- a/ruler.go +++ b/ruler.go @@ -18,6 +18,8 @@ type statData struct { Name string Extension string Size uint64 + DirSize *uint64 + DirCount *uint64 Permissions string ModTime string AccessTime string diff --git a/ui.go b/ui.go index 2f6d4e0a..f64c5e0b 100644 --- a/ui.go +++ b/ui.go @@ -999,11 +999,23 @@ func (ui *ui) drawRulerFile(nav *nav) { curr := nav.currFile() if curr != nil { if curr.err == nil { + var dirsize *uint64 = nil + var dircount *uint64 = nil + if curr.dirSize >= 0 { + v := uint64(curr.dirSize) + dirsize = &v + } + if curr.dirCount >= 0 { + v := uint64(curr.dirCount) + dircount = &v + } stat = &statData{ Path: curr.path, Name: curr.Name(), Extension: curr.ext, Size: uint64(curr.Size()), + DirSize: dirsize, + DirCount: dircount, Permissions: permString(curr.Mode()), ModTime: curr.ModTime().Format(gOpts.timefmt), AccessTime: curr.accessTime.Format(gOpts.timefmt),