Skip to content

Commit

Permalink
feat(#69): add Vim Keys scrolling to issue view
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-5 committed Feb 7, 2024
1 parent be8a154 commit 5ddab23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/issues/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ func (view *issueView) HandleKeyEvent(ev *tcell.EventKey) {
if view.fuzzyFind != nil {
view.fuzzyFind.HandleKeyEvent(ev)
}
if ev.Key() == tcell.KeyUp {
if ev.Key() == tcell.KeyUp || ev.Key() == tcell.KeyTab {
view.scrollY = app.ClampInt(view.scrollY-1, 0, view.maxScrollY)
}
if ev.Key() == tcell.KeyDown {
if ev.Key() == tcell.KeyDown || ev.Key() == tcell.KeyBacktab {
view.scrollY = app.ClampInt(view.scrollY+1, 0, view.maxScrollY)
}
}
Expand Down
12 changes: 12 additions & 0 deletions internal/issues/issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,18 @@ func Test_fjiraIssueView_HandleKeyEvent(t *testing.T) {

// then
assert2.Equal(t, 0, view.scrollY)

// when
view.HandleKeyEvent(tcell.NewEventKey(tcell.KeyBacktab, 'k', tcell.ModNone))

// then
assert2.Equal(t, 1, view.scrollY)

// and when
view.HandleKeyEvent(tcell.NewEventKey(tcell.KeyTab, 'k', tcell.ModNone))

// then
assert2.Equal(t, 0, view.scrollY)
})
}
}

0 comments on commit 5ddab23

Please sign in to comment.