summaryrefslogtreecommitdiff
path: root/internal/picker/keys.go
blob: f5b7135a56baa458e89e5da09d80874f2dd3b2bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package picker

import "github.com/charmbracelet/bubbles/key"

type keybinds struct {
	next, prev key.Binding
}

func newKeybinds() keybinds {
	return keybinds{
		next: key.NewBinding(
			key.WithKeys("j", "down"),
			key.WithHelp("j", "previous slider"),
		),
		prev: key.NewBinding(
			key.WithKeys("k", "up"),
			key.WithHelp("k", "next slider"),
		),
	}
}

func Keys() []key.Binding {
	k := newKeybinds()
	return []key.Binding{k.next, k.prev}
}

func (m Model) AllKeys() []key.Binding {
	return append(Keys(), m.sliders[m.active].AllKeys()...)
}