mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Bump bubbles to get pgup/pgdown in the stash (via the paginator)
This commit is contained in:
parent
f2fce69671
commit
2b42115599
3 changed files with 8 additions and 10 deletions
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module github.com/charmbracelet/glow
|
|||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/charmbracelet/bubbles v0.4.1-0.20200720155635-88469a499e1a
|
||||
github.com/charmbracelet/bubbles v0.4.1-0.20200720161353-5a26cb0d8eb6
|
||||
github.com/charmbracelet/bubbletea v0.10.1-0.20200720155027-2ee871862a49
|
||||
github.com/charmbracelet/charm v0.5.2
|
||||
github.com/charmbracelet/glamour v0.1.1-0.20200521150359-e859bb067c06
|
||||
|
|
4
go.sum
4
go.sum
|
@ -16,8 +16,8 @@ github.com/calmh/randomart v1.1.0 h1:evl+iwc10LXtHdMZhzLxmsCQVmWnkXs44SbC6Uk0Il8
|
|||
github.com/calmh/randomart v1.1.0/go.mod h1:DQUbPVyP+7PAs21w/AnfMKG5NioxS3TbZ2F9MSK/jFM=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/charmbracelet/bubbles v0.4.0/go.mod h1:yhk6OKN3haEO3i/vYQVrvbPamvOPo2dVavWfbpsuUjg=
|
||||
github.com/charmbracelet/bubbles v0.4.1-0.20200720155635-88469a499e1a h1:Saz5ZuA/YfFjTM8Tk2KfAUPDutSIsU+GbSykL4LWUS0=
|
||||
github.com/charmbracelet/bubbles v0.4.1-0.20200720155635-88469a499e1a/go.mod h1:yhk6OKN3haEO3i/vYQVrvbPamvOPo2dVavWfbpsuUjg=
|
||||
github.com/charmbracelet/bubbles v0.4.1-0.20200720161353-5a26cb0d8eb6 h1:aRg6jZ74pEvFkLpPvtP99ZrbZrf1C7bEeOdh9XE/JfM=
|
||||
github.com/charmbracelet/bubbles v0.4.1-0.20200720161353-5a26cb0d8eb6/go.mod h1:yhk6OKN3haEO3i/vYQVrvbPamvOPo2dVavWfbpsuUjg=
|
||||
github.com/charmbracelet/bubbletea v0.9.1-0.20200713153904-2f53eeb54b90/go.mod h1:wjGGC5pyYvpuls0so+w4Zv+aZQW7RoPvsi9UBcDlSl8=
|
||||
github.com/charmbracelet/bubbletea v0.10.0/go.mod h1:wjGGC5pyYvpuls0so+w4Zv+aZQW7RoPvsi9UBcDlSl8=
|
||||
github.com/charmbracelet/bubbletea v0.10.1-0.20200720155027-2ee871862a49 h1:cc2ntD1GuEeaXZ/rweyMZnHYbi3VYPkeGhvVpNJUYQo=
|
||||
|
|
12
ui/stash.go
12
ui/stash.go
|
@ -283,9 +283,7 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) {
|
|||
if msg, ok := msg.(tea.KeyMsg); ok {
|
||||
switch msg.String() {
|
||||
|
||||
case "k":
|
||||
fallthrough
|
||||
case "up":
|
||||
case "k", "up":
|
||||
m.index--
|
||||
if m.index < 0 && m.paginator.Page == 0 {
|
||||
// Stop
|
||||
|
@ -296,9 +294,7 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) {
|
|||
m.index = m.paginator.ItemsOnPage(len(m.markdowns)) - 1
|
||||
}
|
||||
|
||||
case "j":
|
||||
fallthrough
|
||||
case "down":
|
||||
case "j", "down":
|
||||
itemsOnPage := m.paginator.ItemsOnPage(len(m.markdowns))
|
||||
m.index++
|
||||
if m.index >= itemsOnPage && m.paginator.OnLastPage() {
|
||||
|
@ -361,7 +357,9 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
// Update paginator
|
||||
// Update paginator. Pagination key handling is done here, but it could
|
||||
// also be moved up to this level, in which case we'd use model methods
|
||||
// like model.PageUp().
|
||||
newPaginatorModel, cmd := paginator.Update(msg, m.paginator)
|
||||
m.paginator = newPaginatorModel
|
||||
cmds = append(cmds, cmd)
|
||||
|
|
Loading…
Reference in a new issue