Gim/actions.go
Hayden Hargreaves 6c0c289b52 Initial commit
2026-02-08 23:05:59 -07:00

30 lines
599 B
Go

package main
import tea "github.com/charmbracelet/bubbletea"
// Action is the base interface - anything executable
type Action interface {
Execute(m *model) tea.Cmd
}
// Motion moves the cursor and returns the range covered
type Motion interface {
Action
}
// Operator acts on a range (delete, yank, change)
type Operator interface {
Operate(m *model, start, end Position) tea.Cmd
// DoublePress handles dd, yy, cc (line-wise)
DoublePress(m *model) tea.Cmd
}
// Repeatable actions track count
type Repeatable interface {
WithCount(n int) Action
}
type Position struct {
Line, Col int
}