Fix high prio recommendations, add error / health screen
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user