Modify the header as a quick help
This commit is contained in:
parent
af92330682
commit
f2e02756f1
|
@ -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.
|
// Main render function that gets called during the event loop.
|
||||||
func Render(s tcell.Screen, inputs Items, lowerBound int, upperBound int, current int) {
|
func Render(s tcell.Screen, inputs Items, lowerBound int, upperBound int, current int) {
|
||||||
y := 1
|
y := 2
|
||||||
status := fmt.Sprintf("Current: %d | lower: %d | upper: %d | max: %d", current, lowerBound, upperBound, ymax)
|
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)
|
drawText(s, 0, 0, xmax-1, 1, tcell.StyleDefault, status)
|
||||||
for i, item := range (*inputs)[lowerBound:upperBound] {
|
for i, item := range (*inputs)[lowerBound:upperBound] {
|
||||||
style := tcell.StyleDefault
|
style := tcell.StyleDefault
|
||||||
|
@ -143,8 +143,10 @@ func main() {
|
||||||
} else if ev.Key() == tcell.KeyCtrlL {
|
} else if ev.Key() == tcell.KeyCtrlL {
|
||||||
s.Sync()
|
s.Sync()
|
||||||
} else if ev.Rune() == ' ' {
|
} else if ev.Rune() == ' ' {
|
||||||
|
// Mark the current line as selected
|
||||||
item := (*input)[currentLine]
|
item := (*input)[currentLine]
|
||||||
item.Selected = !item.Selected
|
item.Selected = !item.Selected
|
||||||
|
|
||||||
} else if ev.Key() == tcell.KeyUp || ev.Key() == tcell.KeyCtrlP {
|
} else if ev.Key() == tcell.KeyUp || ev.Key() == tcell.KeyCtrlP {
|
||||||
if currentLine > 0 {
|
if currentLine > 0 {
|
||||||
currentLine -= 1
|
currentLine -= 1
|
||||||
|
|
Loading…
Reference in New Issue