fix(textarea): placeholder with chinese chars (#767)

This commit is contained in:
Carlos Alexandro Becker
2025-03-31 19:55:03 -03:00
committed by GitHub
parent bd2a5b0c6a
commit 8b55efb294
3 changed files with 27 additions and 3 deletions
+22
View File
@@ -6,6 +6,7 @@ import (
"unicode"
"github.com/MakeNowJust/heredoc"
"github.com/aymanbagabas/go-udiff"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/x/ansi"
@@ -1671,6 +1672,26 @@ func TestView(t *testing.T) {
`),
},
},
{
name: "placeholder chinese character",
modelFunc: func(m Model) Model {
m.Placeholder = "输入消息..."
m.ShowLineNumbers = true
m.SetWidth(20)
return m
},
want: want{
view: heredoc.Doc(`
> 1 输入消息...
>
>
>
>
>
`),
},
},
}
for _, tt := range tests {
@@ -1689,6 +1710,7 @@ func TestView(t *testing.T) {
wantView := stripString(tt.want.view)
if view != wantView {
t.Log(udiff.Unified("expected", "got", wantView, view))
t.Fatalf("Want:\n%v\nGot:\n%v\n", wantView, view)
}