show number of selected/saved files in status line

cc #143
This commit is contained in:
Gokcehan 2021-02-13 17:45:18 +03:00
parent 9ec336fcdb
commit 1b93f2232e

30
ui.go
View File

@ -244,11 +244,11 @@ func (win *win) printf(screen tcell.Screen, x, y int, st tcell.Style, format str
}
func (win *win) printLine(screen tcell.Screen, x, y int, st tcell.Style, s string) {
win.printf(screen, x, y, st, "%s%*s", s, win.w-len(s), "")
win.printf(screen, x, y, st, "%s%*s", s, win.w-printLength(s), "")
}
func (win *win) printRight(screen tcell.Screen, y int, st tcell.Style, s string) {
win.print(screen, win.w-len(s), y, st, s)
win.print(screen, win.w-printLength(s), y, st, s)
}
func (win *win) printReg(screen tcell.Screen, reg *reg) {
@ -729,6 +729,30 @@ func (ui *ui) drawStatLine(nav *nav) {
ind := min(dir.ind+1, tot)
acc := string(ui.keyCount) + string(ui.keyAcc)
var selection string
if len(nav.saves) > 0 {
copy := 0
move := 0
for _, cp := range nav.saves {
if cp {
copy++
} else {
move++
}
}
if copy > 0 {
selection += fmt.Sprintf(" \033[33;7m %d \033[0m", copy)
}
if move > 0 {
selection += fmt.Sprintf(" \033[31;7m %d \033[0m", move)
}
}
if len(nav.selections) > 0 {
selection += fmt.Sprintf(" \033[35;7m %d \033[0m", len(nav.selections))
}
var progress string
if nav.copyTotal > 0 {
@ -744,7 +768,7 @@ func (ui *ui) drawStatLine(nav *nav) {
progress += fmt.Sprintf(" [%d/%d]", nav.deleteCount, nav.deleteTotal)
}
ruler := fmt.Sprintf("%s%s %d/%d", acc, progress, ind, tot)
ruler := fmt.Sprintf("%s%s%s %d/%d", acc, progress, selection, ind, tot)
ui.msgWin.printRight(ui.screen, 0, st, ruler)
}