30 lines
575 B
Go
30 lines
575 B
Go
package tui
|
|
|
|
import (
|
|
tea "charm.land/bubbletea/v2"
|
|
)
|
|
|
|
func isQuit(msg tea.KeyPressMsg) bool {
|
|
s := msg.String()
|
|
return s == "q" || s == "ctrl+c" || s == "esc"
|
|
}
|
|
|
|
func isNavigateDown(msg tea.KeyPressMsg) bool {
|
|
s := msg.String()
|
|
return s == "down" || s == "j" || s == "tab"
|
|
}
|
|
|
|
func isNavigateUp(msg tea.KeyPressMsg) bool {
|
|
s := msg.String()
|
|
return s == "up" || s == "k" || s == "shift+tab"
|
|
}
|
|
|
|
func isActivate(msg tea.KeyPressMsg) bool {
|
|
s := msg.String()
|
|
return s == "enter" || s == " "
|
|
}
|
|
|
|
func isSubmit(msg tea.KeyPressMsg) bool {
|
|
return msg.String() == "enter"
|
|
}
|