Skip to content

Commit

Permalink
Add top/bottom hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
tnierman authored and clcollins committed Mar 1, 2024
1 parent 188aa2e commit e1153be
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/tui/keymap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ func (k keymap) FullHelp() [][]key.Binding {
type keymap struct {
Up key.Binding
Down key.Binding
Top key.Binding
Bottom key.Binding
Back key.Binding
Enter key.Binding
Quit key.Binding
Expand All @@ -43,6 +45,14 @@ var defaultKeyMap = keymap{
key.WithKeys("j", "down"),
key.WithHelp("↓/j", "down"),
),
Top: key.NewBinding(
key.WithKeys("g"),
key.WithHelp("g", "jump to top"),
),
Bottom: key.NewBinding(
key.WithKeys("G"),
key.WithHelp("G", "jump to bottom"),
),
Quit: key.NewBinding(
key.WithKeys("q", "ctrl+c"),
key.WithHelp("q/ctrl+c", "quit"),
Expand Down
6 changes: 6 additions & 0 deletions pkg/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,12 @@ func switchTableFocusMode(m model, msg tea.Msg) (tea.Model, tea.Cmd) {
case key.Matches(msg, defaultKeyMap.Down):
m.table.MoveDown(1)

case key.Matches(msg, defaultKeyMap.Top):
m.table.GotoTop()

case key.Matches(msg, defaultKeyMap.Bottom):
m.table.GotoBottom()

case key.Matches(msg, defaultKeyMap.Enter):
m.viewingIncident = true
return m, tea.Sequence(
Expand Down

0 comments on commit e1153be

Please sign in to comment.