diff --git a/kittens/choose_files/main.go b/kittens/choose_files/main.go index f09479406..5acba7fd3 100644 --- a/kittens/choose_files/main.go +++ b/kittens/choose_files/main.go @@ -53,7 +53,7 @@ func (h *Handler) draw_screen() (err error) { h.draw_search_bar(0) }() y := SEARCH_BAR_HEIGHT - y += h.draw_results(y, 4, matches, in_progress) + y += h.draw_results(y, 2, matches, in_progress) return } diff --git a/kittens/choose_files/results.go b/kittens/choose_files/results.go index cf61cb1da..0a44234f8 100644 --- a/kittens/choose_files/results.go +++ b/kittens/choose_files/results.go @@ -93,11 +93,20 @@ func (h *Handler) render_match_with_positions(text string, stop_at int, position } } +var icon_cache map[string]string + func icon_for(path string, x os.DirEntry) string { + if icon_cache == nil { + icon_cache = make(map[string]string, 512) + } + if ans := icon_cache[path]; ans != "" { + return ans + } ans := icons.IconForFileWithMode(path, x.Type(), true) if wcswidth.Stringwidth(ans) == 1 { ans += " " } + icon_cache[path] = ans return ans }