Gim/internal/motion/command.go
Hayden Hargreaves ccb061989a refactor: huge refactor, this looks amazing.
Lots of comments from the AI. Some tests are not passing though
2026-03-04 21:45:47 -07:00

34 lines
1.2 KiB
Go

package motion
import (
"git.gophernest.net/azpect/TextEditor/internal/action"
"git.gophernest.net/azpect/TextEditor/internal/core"
tea "github.com/charmbracelet/bubbletea"
)
// MoveCommandLeft implements Motion - moves cursor left in command line.
type MoveCommandLeft struct{}
// MoveCommandLeft.Execute: Moves the command line cursor one position to the left.
func (a MoveCommandLeft) Execute(m action.Model) tea.Cmd {
// The set function handles bounds
m.SetCommandCursor(m.CommandCursor() - 1)
return nil
}
// MoveCommandLeft.Type: Returns CharwiseExclusive for command line motion.
func (a MoveCommandLeft) Type() core.MotionType { return core.CharwiseExclusive }
// MoveCommandRight implements Motion - moves cursor right in command line.
type MoveCommandRight struct{}
// MoveCommandRight.Execute: Moves the command line cursor one position to the right.
func (a MoveCommandRight) Execute(m action.Model) tea.Cmd {
// The set function handles bounds
m.SetCommandCursor(m.CommandCursor() + 1)
return nil
}
// MoveCommandRight.Type: Returns CharwiseExclusive for command line motion.
func (a MoveCommandRight) Type() core.MotionType { return core.CharwiseExclusive }