From f2e02756f124b8152201307d83b3c78e7b40fb54 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Wed, 23 Nov 2022 21:34:30 +0000 Subject: [PATCH] Modify the header as a quick help --- filter.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/filter.go b/filter.go index fe76663..afd8151 100644 --- a/filter.go +++ b/filter.go @@ -53,8 +53,8 @@ func drawText(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string // Main render function that gets called during the event loop. func Render(s tcell.Screen, inputs Items, lowerBound int, upperBound int, current int) { - y := 1 - status := fmt.Sprintf("Current: %d | lower: %d | upper: %d | max: %d", current, lowerBound, upperBound, ymax) + y := 2 + status := fmt.Sprintf("Navigation: [UP or C-p] [Down or C-n] Select: SPACE Cancel: [q ESC] Done: [Enter] Line: %d", current) drawText(s, 0, 0, xmax-1, 1, tcell.StyleDefault, status) for i, item := range (*inputs)[lowerBound:upperBound] { style := tcell.StyleDefault @@ -143,8 +143,10 @@ func main() { } else if ev.Key() == tcell.KeyCtrlL { s.Sync() } else if ev.Rune() == ' ' { + // Mark the current line as selected item := (*input)[currentLine] item.Selected = !item.Selected + } else if ev.Key() == tcell.KeyUp || ev.Key() == tcell.KeyCtrlP { if currentLine > 0 { currentLine -= 1