Adds g and G to lane navigation and fixes an offset issue
This commit is contained in:
parent
a85b782cf0
commit
18ba29d42f
19
board.go
19
board.go
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue