Forgot this

This commit is contained in:
Hayden Hargreaves 2026-02-08 23:25:38 -07:00
parent e7405a8d19
commit 4003f411e0

View File

@ -96,22 +96,22 @@ func (m *model) replayInsert() {
func (m *model) processInsertKey(key string) {
switch key {
case "enter":
y := m.cursor.y
x := m.cursor.x
y := m.cursor.y
x := m.cursor.x
// Simple case, at end, just create a line
if x == len(m.lines[y]) {
m.lines = append(m.lines[:y+1], append([]string{""}, m.lines[y+1:]...)...)
// Simple case, at end, just create a line
if x == len(m.lines[y]) {
m.lines = append(m.lines[:y+1], append([]string{""}, m.lines[y+1:]...)...)
// otherwise, splice
} else {
l := m.lines[y]
m.lines[y] = l[:x]
m.lines = append(m.lines[:y+1], append([]string{l[x:]}, m.lines[y+1:]...)...)
}
// otherwise, splice
} else {
l := m.lines[y]
m.lines[y] = l[:x]
m.lines = append(m.lines[:y+1], append([]string{l[x:]}, m.lines[y+1:]...)...)
}
m.cursor.y++
m.cursor.x = 0
m.cursor.y++
m.cursor.x = 0
case "backspace":
x := m.cursor.x