Maintain history; use state

This commit is contained in:
Madison Rye Progress
2025-09-13 20:58:36 -07:00
parent bef9cd248e
commit f3b3803535
7 changed files with 63 additions and 12 deletions

View File

@ -3,47 +3,55 @@ package state
func (s *State) CursorCellUp() {
if s.cursor.Y >= 1 {
s.cursor.Y--
s.history += "u"
}
}
func (s *State) CursorCellDown() {
if s.cursor.Y < s.size()-1 {
s.cursor.Y++
s.history += "d"
}
}
func (s *State) CursorCellRight() {
if s.cursor.X < s.size()-1 {
s.cursor.X++
s.history += "r"
}
}
func (s *State) CursorCellLeft() {
if s.cursor.X >= 1 {
s.cursor.X--
s.history += "l"
}
}
func (s *State) CursorSectionUp() {
if s.cursor.Y >= s.cellsPerSection {
s.cursor.Y -= s.cellsPerSection
s.history += "U"
}
}
func (s *State) CursorSectionDown() {
if s.cursor.Y < s.size()-s.cellsPerSection {
s.cursor.Y += s.cellsPerSection
s.history += "D"
}
}
func (s *State) CursorSectionRight() {
if s.cursor.X < s.size()-s.cellsPerSection {
s.cursor.X += s.cellsPerSection
s.history += "R"
}
}
func (s *State) CursorSectionLeft() {
if s.cursor.X >= s.cellsPerSection {
s.cursor.X -= s.cellsPerSection
s.history += "L"
}
}