Optimisation & fixes

This commit is contained in:
2026-06-21 12:59:55 +01:00
parent ab65c2e17b
commit d5125a0d62
14 changed files with 1074 additions and 126 deletions
+14 -2
View File
@@ -139,6 +139,18 @@ func renderBreadcrumb(parts ...string) string {
return breadcrumbStyle.Render(strings.Join(parts, " / "))
}
// scrollUpIndicator returns the styled "more items above" hint shown when a
// viewport is scrolled down past its first item.
func scrollUpIndicator() string {
return mutedStyle.Render(" ↑ More above ↑") + "\n"
}
// scrollDownIndicator returns the styled "more items below" hint shown when a
// viewport has items beyond its last visible row.
func scrollDownIndicator() string {
return mutedStyle.Render(" ↓ More below ↓") + "\n"
}
// renderList renders a list of items with cursor selection and viewport scrolling
func renderList(items []string, cursor int, prefix string, scrollOffset int) string {
var b strings.Builder
@@ -147,7 +159,7 @@ func renderList(items []string, cursor int, prefix string, scrollOffset int) str
// Show scroll up indicator if there are items above the viewport
if scrollOffset > 0 {
b.WriteString(mutedStyle.Render(" ↑ More above ↑") + "\n")
b.WriteString(scrollUpIndicator())
}
// Calculate visible range
@@ -171,7 +183,7 @@ func renderList(items []string, cursor int, prefix string, scrollOffset int) str
// Show scroll down indicator if there are items below the viewport
if end < totalItems {
b.WriteString(mutedStyle.Render(" ↓ More below ↓") + "\n")
b.WriteString(scrollDownIndicator())
}
return b.String()