Gim/internal/action/misc.go
Hayden Hargreaves b1b3edf810 feat: this is huge, and needs some review, but for now its good
The tests are not passing, something to do with view I think.
2026-02-26 23:18:18 -07:00

56 lines
1.2 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 {
win := m.ActiveWindow()
win.SetAnchorCol(win.Cursor.Col)
win.SetAnchorLine(win.Cursor.Line)
m.SetMode(VisualMode)
return nil
}
// Quit implements Action (V)
type EnterVisualLineMode struct{}
func (a EnterVisualLineMode) Execute(m Model) tea.Cmd {
win := m.ActiveWindow()
win.SetAnchorCol(win.Cursor.Col)
win.SetAnchorLine(win.Cursor.Line)
m.SetMode(VisualLineMode)
return nil
}
// Quit implements Action (ctrl+v)
type EnterVisualBlockMode struct{}
func (a EnterVisualBlockMode) Execute(m Model) tea.Cmd {
win := m.ActiveWindow()
win.SetAnchorCol(win.Cursor.Col)
win.SetAnchorLine(win.Cursor.Line)
m.SetMode(VisualBlockMode)
return nil
}