Skip to content

Commit

Permalink
add alt+enter shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Nov 20, 2023
1 parent 834a6a7 commit 13fddc0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion internal/tui/statusbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,23 @@ func (p StatusBar) Update(msg tea.Msg) (StatusBar, tea.Cmd) {
if len(p.actions) == 0 {
return p, nil
}

action := p.actions[p.cursor]
p.expanded = false
p.cursor = 0

return p, func() tea.Msg {
return action
}
case "alt+enter":
if p.cursor != 0 || len(p.actions) < 2 {
break
}

p.expanded = false
p.cursor = 0
return p, func() tea.Msg {
return p.actions[1]
}
case "ctrl+d":
if p.expanded {
break
Expand Down Expand Up @@ -132,6 +142,8 @@ func (c StatusBar) View() string {
var subtitle string
if i == 0 {
subtitle = "enter"
} else if i == 1 {
subtitle = "alt+enter"
} else if action.Key != "" {
subtitle = fmt.Sprintf("alt+%s", action.Key)
}
Expand Down

0 comments on commit 13fddc0

Please sign in to comment.