mirror of
https://github.com/charmbracelet/gum
synced 2024-06-08 08:42:16 +02:00
feat(file): Add page up/down key bindings
This commit is contained in:
parent
83db83296a
commit
5431540431
24
file/file.go
24
file/file.go
|
@ -129,6 +129,30 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
m.min--
|
||||
m.max--
|
||||
}
|
||||
case "J", "pgdown":
|
||||
m.selected += m.height
|
||||
if m.selected >= len(m.files) {
|
||||
m.selected = len(m.files) - 1
|
||||
}
|
||||
m.min += m.height
|
||||
m.max += m.height
|
||||
|
||||
if m.max >= len(m.files) {
|
||||
m.max = len(m.files) - 1
|
||||
m.min = m.max - m.height
|
||||
}
|
||||
case "K", "pgup":
|
||||
m.selected -= m.height
|
||||
if m.selected < 0 {
|
||||
m.selected = 0
|
||||
}
|
||||
m.min -= m.height
|
||||
m.max -= m.height
|
||||
|
||||
if m.min < 0 {
|
||||
m.min = 0
|
||||
m.max = m.min + m.height
|
||||
}
|
||||
case "ctrl+c", "q":
|
||||
m.path = ""
|
||||
m.quitting = true
|
||||
|
|
Loading…
Reference in a new issue