Limit the number of selections displayed in the footer

This commit is contained in:
Kovid Goyal
2025-07-11 10:40:43 +05:30
parent 513fd720eb
commit b4e75bf475

View File

@@ -72,13 +72,18 @@ func (h *Handler) draw_footer() (num_lines int, err error) {
flush()
}
if len(h.state.selections) > 0 {
before := len(lines)
w("", " Selected:", nil, "", nil)
for _, s := range h.state.selections {
for i, s := range h.state.selections {
text := s
if rel, rerr := filepath.Rel(h.state.CurrentDir(), s); rerr == nil {
text = rel
}
w(" ", text, nil, s, func(abspath string) { h.state.ToggleSelection(abspath) })
if len(lines)-before > 2 && len(h.state.selections)-i-1 > 3 {
w(" ", fmt.Sprintf("and %d more…", len(h.state.selections)-1-i), nil, "", nil)
break
}
}
flush()
}