on main help sign in
fix(ui): dry up session dialog key bindings
fa5c593Ayman Bagabas
internal/ui/dialog/sessions.go+6−5
@@ -27,6 +27,7 @@ type Session struct {
27 Select key.Binding
27 Select key.Binding
28 Next key.Binding
28 Next key.Binding
29 Previous key.Binding
29 Previous key.Binding
30+ UpDown key.Binding
30 Close key.Binding
31 Close key.Binding
31 }
32 }
32}
33}
@@ -74,6 +75,10 @@ func NewSessions(com *common.Common, selectedSessionID string) (*Session, error)
74 key.WithKeys("up", "ctrl+p"),
75 key.WithKeys("up", "ctrl+p"),
75 key.WithHelp("↑", "previous item"),
76 key.WithHelp("↑", "previous item"),
76 )
77 )
78+ s.keyMap.UpDown = key.NewBinding(
79+ key.WithKeys("up", "down"),
80+ key.WithHelp("↑↓", "choose"),
81+ )
77 s.keyMap.Close = CloseKey
82 s.keyMap.Close = CloseKey
78
83
79 return s, nil
84 return s, nil
@@ -167,12 +172,8 @@ func (s *Session) View() string {
167
172
168// ShortHelp implements [help.KeyMap].
173// ShortHelp implements [help.KeyMap].
169func (s *Session) ShortHelp() []key.Binding {
174func (s *Session) ShortHelp() []key.Binding {
170− updown := key.NewBinding(
171− key.WithKeys("down", "up"),
172− key.WithHelp("↑↓", "choose"),
173− )
174 return []key.Binding{
175 return []key.Binding{
175− updown,
176+ s.keyMap.UpDown,
176 s.keyMap.Select,
177 s.keyMap.Select,
177 s.keyMap.Close,
178 s.keyMap.Close,
178 }
179 }