2
1
Fork 0

Adds g and G to lane navigation and fixes an offset issue

This commit is contained in:
sloum 2021-03-26 19:53:37 -07:00
parent a85b782cf0
commit 18ba29d42f
1 changed files with 18 additions and 1 deletions

View File

@ -78,6 +78,23 @@ func (b *Board) Run() {
b.StoryOpen = true
b.ViewStory()
b.StoryOpen = false
case 'g':
if len(b.Lanes[b.Current].Stories) > 0 {
b.Lanes[b.Current].Current = 0
b.Lanes[b.Current].storyOff = 0
}
case 'G':
if len(b.Lanes[b.Current].Stories) > 0 {
b.Lanes[b.Current].Current = len(b.Lanes[b.Current].Stories)-1
if b.Lanes[b.Current].Current * 3 + 1 > b.height-5 {
off := b.Lanes[b.Current].Current - 3 % (b.height-5)
if off+1 > b.height-5 {
b.Lanes[b.Current].storyOff = off
} else {
b.Lanes[b.Current].storyOff = off+1
}
}
}
case 'h', 'j', 'k', 'l', 'H', 'L', 'K', 'J':
b.ClearMessage()
b.Move(ch)
@ -358,7 +375,7 @@ func (b *Board) Move(ch rune) {
// move selection down a story
if b.Lanes[b.Current].Current < len(b.Lanes[b.Current].Stories)-1 {
b.Lanes[b.Current].Current += 1
if b.Lanes[b.Current].Current * 3 + 1 > b.height-5 {
if b.Lanes[b.Current].Current * 3 + 1 - (b.Lanes[b.Current].storyOff*3) >= b.height-4 {
b.Lanes[b.Current].storyOff += 1
}
} else {