Show directory size in ruler (#2343)

* Added dirSize to Size field and changed humanize function accordingly

* Seperated size into own fields and changed type to use pointers

* Added Documentation and Changelog
This commit is contained in:
SPFab authored and GitHub committed 2026-01-20 13:01:23 +11:00
1 parent b5d981ad4a
commit fa8e3788de
6 files changed
+22 -2

No files matched your search

+1 -1
View File
@@ -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). - 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). - 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). - 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 ### Fixed
+2
View File
@@ -2238,6 +2238,8 @@ The following data fields are exported:
.Stat.Name string Name of the current file .Stat.Name string Name of the current file
.Stat.Extension string Extension of the current file .Stat.Extension string Extension of the current file
.Stat.Size uint64 Size 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.Permissions string Permissions of the current file
.Stat.ModTime string Last modified time of the current file (formatted based on the `timefmt` option) .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) .Stat.AccessTime string Last access time of the current file (formatted based on the `timefmt` option)
+2
View File
@@ -2512,6 +2512,8 @@ The following data fields are exported:
.Stat.Name string Name of the current file .Stat.Name string Name of the current file
.Stat.Extension string Extension of the current file .Stat.Extension string Extension of the current file
.Stat.Size uint64 Size 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.Permissions string Permissions of the current file
.Stat.ModTime string Last modified time of the current file (formatted based on the `timefmt` option) .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) .Stat.AccessTime string Last access time of the current file (formatted based on the `timefmt` option)
+3 -1
View File
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.7.0.2 .\" 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 .SH NAME
lf \- terminal file manager lf \- terminal file manager
.SH SYNOPSIS .SH SYNOPSIS
@@ -2548,6 +2548,8 @@ The following data fields are exported:
\&.Stat.Name string Name of the current file \&.Stat.Name string Name of the current file
\&.Stat.Extension string Extension of the current file \&.Stat.Extension string Extension of the current file
\&.Stat.Size uint64 Size 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.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.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) \&.Stat.AccessTime string Last access time of the current file (formatted based on the \(gatimefmt\(ga option)
+2
View File
@@ -18,6 +18,8 @@ type statData struct {
Name string Name string
Extension string Extension string
Size uint64 Size uint64
DirSize *uint64
DirCount *uint64
Permissions string Permissions string
ModTime string ModTime string
AccessTime string AccessTime string
+12
View File
@@ -999,11 +999,23 @@ func (ui *ui) drawRulerFile(nav *nav) {
curr := nav.currFile() curr := nav.currFile()
if curr != nil { if curr != nil {
if curr.err == 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{ stat = &statData{
Path: curr.path, Path: curr.path,
Name: curr.Name(), Name: curr.Name(),
Extension: curr.ext, Extension: curr.ext,
Size: uint64(curr.Size()), Size: uint64(curr.Size()),
DirSize: dirsize,
DirCount: dircount,
Permissions: permString(curr.Mode()), Permissions: permString(curr.Mode()),
ModTime: curr.ModTime().Format(gOpts.timefmt), ModTime: curr.ModTime().Format(gOpts.timefmt),
AccessTime: curr.accessTime.Format(gOpts.timefmt), AccessTime: curr.accessTime.Format(gOpts.timefmt),