make keybinds configurable and consolidate

This commit is contained in:
2026-07-28 14:55:38 +02:00
parent bb8e91039f
commit 948f3e1a79
12 changed files with 1469 additions and 158 deletions

View File

@@ -16,6 +16,21 @@ type memoryTextClipboard struct {
writeErr error
}
func TestVimEditorUsesSharedConfiguredNavigation(t *testing.T) {
editor := newTextEditor("first\nsecond", true)
editor.keys.Navigation.Down = []string{"ctrl+j"}
editor.keys.Navigation.Up = []string{"ctrl+k"}
editor.handleKey(runeKey("j"), true)
if editor.Cursor != 0 {
t.Fatalf("removed default j moved cursor to %d", editor.Cursor)
}
editor.handleKey(tea.KeyMsg{Type: tea.KeyCtrlJ}, true)
if editor.Cursor != len([]rune("first\n")) {
t.Fatalf("configured ctrl+j moved cursor to %d", editor.Cursor)
}
}
func (c *memoryTextClipboard) ReadText() (string, error) {
return c.text, c.readErr
}