feat: implement arrow keys in insert mode. Untested.

This commit is contained in:
Hayden Hargreaves 2026-02-10 22:26:56 -07:00
parent 2cadb09350
commit 0a149b4e44

View File

@ -210,6 +210,35 @@ func (m *Model) processInsertKey(key string) {
}
m.SetCursorX(x + len(tabs))
case "up":
if y > 0 {
m.SetCursorY(y - 1)
m.ClampCursorX()
}
case "down":
if y+1 < m.LineCount() {
m.SetCursorY(y + 1)
m.ClampCursorX()
}
case "left":
if x > 0 {
m.SetCursorX(x - 1)
} else if y > 0 {
prevLine := m.Line(y - 1)
m.SetCursorX(len(prevLine))
m.SetCursorY(y - 1)
}
case "right":
if x < len(l) {
m.SetCursorX(x + 1)
} else if y+1 < m.LineCount() {
m.SetCursorX(0)
m.SetCursorY(y + 1)
}
// Regular character
default:
if x < len(l) {