Gim/internal/action/misc.go
2026-02-11 15:00:02 -07:00

49 lines
979 B
Go

package action
import tea "github.com/charmbracelet/bubbletea"
// Quit implements Action (ctrl+c)
type Quit struct{}
func (a Quit) Execute(m Model) tea.Cmd {
return tea.Quit
}
// Quit implements Action (:)
type EnterComandMode struct{}
func (a EnterComandMode) Execute(m Model) tea.Cmd {
m.SetMode(CommandMode)
return nil
}
// Quit implements Action (v)
type EnterVisualMode struct{}
func (a EnterVisualMode) Execute(m Model) tea.Cmd {
m.SetAnchorX(m.CursorX())
m.SetAnchorY(m.CursorY())
m.SetMode(VisualMode)
return nil
}
// Quit implements Action (V)
type EnterVisualLineMode struct{}
func (a EnterVisualLineMode) Execute(m Model) tea.Cmd {
m.SetAnchorX(m.CursorX())
m.SetAnchorY(m.CursorY())
m.SetMode(VisualLineMode)
return nil
}
// Quit implements Action (ctrl+v)
type EnterVisualBlockMode struct{}
func (a EnterVisualBlockMode) Execute(m Model) tea.Cmd {
m.SetAnchorX(m.CursorX())
m.SetAnchorY(m.CursorY())
m.SetMode(VisualBlockMode)
return nil
}