chore!: change to use v3 of Tcell (#2286)
* Remove SGR 8 * Remove `<backspace2>` * Migrate to v3 of Tcell * Refactor key handling functionality * Bump Tcell version * Replace `SetContent` API with `Put` API * bump dependencies * Use new color package * Fix cursor position for grapheme clusters * Some editing fixes to support grapheme clusters * Ignore carriage return when printing * Move grapheme cluster handling into misc.go * Fix length of filenames containing emoji * Use slices.Concat * Use `string` instead of `[]rune` for `win.print` * Add note about modifier limitations * Update `CHANGELOG.md`
This commit is contained in:
1 parent
a446855e76
commit
6ec60cf9d8
21 files changed
+558
-463
No files matched your search
@@ -126,6 +126,42 @@ func TestRuneSliceWidthLastRange(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFirstGraphemeCluster(t *testing.T) {
|
||||
tests := []struct {
|
||||
rs []rune
|
||||
exp []rune
|
||||
}{
|
||||
{[]rune{}, nil},
|
||||
{[]rune{'a'}, []rune{'a'}},
|
||||
{[]rune{'世', '界'}, []rune{'世'}},
|
||||
{[]rune{0x1f3f3, 0xfe0f, 'a'}, []rune{0x1f3f3, 0xfe0f}}, // white flag
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
if got := firstGraphemeCluster(test.rs); !reflect.DeepEqual(got, test.exp) {
|
||||
t.Errorf("at input '%v' expected '%v' but got '%v'", test.rs, test.exp, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLastGraphemeCluster(t *testing.T) {
|
||||
tests := []struct {
|
||||
rs []rune
|
||||
exp []rune
|
||||
}{
|
||||
{[]rune{}, nil},
|
||||
{[]rune{'a'}, []rune{'a'}},
|
||||
{[]rune{'世', '界'}, []rune{'界'}},
|
||||
{[]rune{'a', 0x1f3f3, 0xfe0f}, []rune{0x1f3f3, 0xfe0f}}, // white flag
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
if got := lastGraphemeCluster(test.rs); !reflect.DeepEqual(got, test.exp) {
|
||||
t.Errorf("at input '%v' expected '%v' but got '%v'", test.rs, test.exp, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCmdEscape(t *testing.T) {
|
||||
tests := []struct {
|
||||
s string
|
||||
|
||||
Reference in new issue
Block a user