27 lines
652 B
Go
27 lines
652 B
Go
package motion
|
|
|
|
import (
|
|
"git.gophernest.net/azpect/TextEditor/internal/action"
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
type MoveCommandLeft struct{}
|
|
|
|
func (a MoveCommandLeft) Execute(m action.Model) tea.Cmd {
|
|
// The set function handles bounds
|
|
m.SetCommandCursor(m.CommandCursor() - 1)
|
|
return nil
|
|
}
|
|
|
|
func (a MoveCommandLeft) Type() action.MotionType { return action.Charwise }
|
|
|
|
type MoveCommandRight struct{}
|
|
|
|
func (a MoveCommandRight) Execute(m action.Model) tea.Cmd {
|
|
// The set function handles bounds
|
|
m.SetCommandCursor(m.CommandCursor() + 1)
|
|
return nil
|
|
}
|
|
|
|
func (a MoveCommandRight) Type() action.MotionType { return action.Charwise }
|