Fix high prio recommendations, add error / health screen

This commit is contained in:
2026-07-28 15:40:11 +02:00
parent 948f3e1a79
commit 7511311297
19 changed files with 1885 additions and 148 deletions

View File

@@ -170,6 +170,47 @@ func TestVimTextEditorSubstituteDeletesCharacterAndEntersInsert(t *testing.T) {
}
}
func TestEditorMotionsAndDeletionPreserveGraphemeClusters(t *testing.T) {
tests := []struct {
name string
cluster string
}{
{name: "combining mark", cluster: "e\u0301"},
{name: "emoji with variation selector", cluster: "❤️"},
{name: "multi-code-point emoji", cluster: "👨‍👩‍👧‍👦"},
{name: "full-width character", cluster: "界"},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
editor := newTextEditor(test.cluster+"x", true)
editor.handleKey(runeKey("l"), true)
want := len([]rune(test.cluster))
if editor.Cursor != want {
t.Fatalf("cursor = %d, want grapheme boundary %d", editor.Cursor, want)
}
editor.handleKey(runeKey("h"), true)
if editor.Cursor != 0 {
t.Fatalf("reverse cursor = %d, want 0", editor.Cursor)
}
editor.handleKey(runeKey("x"), true)
if editor.Text != "x" || editor.Cursor != 0 {
t.Fatalf("delete split grapheme: text=%q cursor=%d", editor.Text, editor.Cursor)
}
})
}
}
func TestEditorVisualYankIncludesWholeGrapheme(t *testing.T) {
clipboard := &memoryTextClipboard{}
editor := newTextEditor("e\u0301x", true)
editor.clipboard = clipboard
editor.handleKey(runeKey("v"), true)
editor.handleKey(runeKey("y"), true)
if clipboard.written != "e\u0301" {
t.Fatalf("yanked text = %q, want complete combining grapheme", clipboard.written)
}
}
func TestVimTextEditorNormalMotionsStayOnCharactersWithinLine(t *testing.T) {
editor := newTextEditor("ab\n cd\n", true)
editor.Cursor = 1