Added C and fixed pasting in viminput

This commit is contained in:
2024-12-08 22:51:53 +02:00
parent bca8e44586
commit 2a6f5c2c3d

View File

@@ -232,6 +232,9 @@ func (m *Model) handleNormalModeKeys(key tea.KeyMsg) {
m.SetCursorColumn(m.cursorColumn - 1)
}
}
case "C":
m.mode = InsertMode
fallthrough
case "D":
line := m.lines[m.cursorLine]
if len(line) != 0 {
@@ -258,7 +261,14 @@ func (m *Model) handleNormalModeKeys(key tea.KeyMsg) {
line := m.lines[m.cursorLine]
if len(lines) == 1 {
pastedLine := []rune(lines[0])
m.lines[m.cursorLine] = slices.Insert(line, m.cursorColumn+1, pastedLine...)
if m.cursorColumn+1 >= len(line) {
m.lines[m.cursorLine] = append(line, pastedLine...)
} else {
m.lines[m.cursorLine] = slices.Insert(line, m.cursorColumn+1, pastedLine...)
}
if len(line) == 0 {
m.SetCursorColumn(m.cursorColumn - 1)
}
m.SetCursorColumn(m.cursorColumn + len(pastedLine))
}
case "P":