Gim/internal/action/misc.go
Hayden Hargreaves ee7bf9354b feat: rough command mode implementation
I am starting to develop so fast, testing is such a life saver, oh my
god.
2026-02-13 23:16:47 -07:00

53 lines
1.0 KiB
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)
m.SetCommand("")
m.SetCommandOutput("")
m.SetCommandError(nil)
m.SetCommandCursor(0)
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
}