Modify the header as a quick help

This commit is contained in:
Sameer Rahmani 2022-11-23 21:34:30 +00:00
parent af92330682
commit f2e02756f1
1 changed files with 4 additions and 2 deletions

View File

@ -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