WhspBrd/internal/tui/keybindings.go
copilot-swe-agent[bot] b4b65b9b60 Implement scrolling with J/K keys and fix image positioning
Co-authored-by: foglar <82380203+foglar@users.noreply.github.com>
2025-10-09 09:59:27 +00:00

41 lines
1.1 KiB
Go

package tui
import (
"github.com/jroimartin/gocui"
)
func keybindings(g *gocui.Gui) error {
if err := g.SetKeybinding("input", gocui.KeyEnter, gocui.ModNone, sendMessage); err != nil {
return err
}
if err := g.SetKeybinding("", gocui.KeyCtrlJ, gocui.ModNone, nextContact); err != nil {
return err
}
if err := g.SetKeybinding("", gocui.KeyCtrlK, gocui.ModNone, prevContact); err != nil {
return err
}
if err := g.SetKeybinding("", 'j', gocui.ModNone, scrollChatDown); err != nil {
return err
}
if err := g.SetKeybinding("", 'J', gocui.ModNone, scrollChatDown); err != nil {
return err
}
if err := g.SetKeybinding("", 'k', gocui.ModNone, scrollChatUp); err != nil {
return err
}
if err := g.SetKeybinding("", 'K', gocui.ModNone, scrollChatUp); err != nil {
return err
}
if err := g.SetKeybinding("", gocui.KeyTab, gocui.ModNone, toggleProfileView); err != nil {
return err
}
if err := g.SetKeybinding("", gocui.KeyCtrlQ, gocui.ModNone, quit); err != nil {
return err
}
return nil
}
func quit(g *gocui.Gui, v *gocui.View) error {
return gocui.ErrQuit
}