Add scroll percentage to rulerfmt option (#1985)

This commit is contained in:
Joe Lim authored and GitHub committed 2025-05-12 14:28:26 +10:00
1 parent fea705ef7f
commit e7ea6c6d0d
5 files changed
+29 -13

No files matched your search

+15
View File
@@ -892,6 +892,19 @@ func (ui *ui) drawRuler(nav *nav) {
hid := len(dir.allFiles) - tot
acc := string(ui.keyCount) + string(ui.keyAcc)
var percentage string
beg := max(dir.ind-dir.pos, 0)
switch {
case tot <= nav.height:
percentage = "All"
case beg == 0:
percentage = "Top"
case beg == tot-nav.height:
percentage = "Bot"
default:
percentage = fmt.Sprintf("%2d%%", beg*100/(tot-nav.height))
}
copy := 0
move := 0
for _, cp := range nav.saves {
@@ -943,6 +956,8 @@ func (ui *ui) drawRuler(nav *nav) {
result = strconv.Itoa(tot)
case "%h":
result = strconv.Itoa(hid)
case "%P":
result = percentage
case "%d":
result = diskFree(dir.path)
default: