feat: add g and shift+g keybindings for the sidepanel

This commit is contained in:
2022-01-21 04:52:41 +02:00
parent 26deca05d9
commit 69e4240def
+13 -1
View File
@@ -72,10 +72,22 @@ func (s SidePanelState) Update(msg tea.Msg) (SidePanelState, tea.Cmd) {
var cmd tea.Cmd var cmd tea.Cmd
var cmds []tea.Cmd var cmds []tea.Cmd
switch msg.(type) { switch msg := msg.(type) {
case SwitchChannelsMsg: case SwitchChannelsMsg:
s.UpdateNicks() s.UpdateNicks()
return s, nil return s, nil
case tea.KeyMsg:
key := msg.String()
switch key {
case "g":
if s.Focused {
s.Viewport.GotoTop()
}
case "G":
if s.Focused {
s.Viewport.GotoBottom()
}
}
} }
if s.Focused { if s.Focused {