diff --git a/widget/entry.go b/widget/entry.go index 2988e5593c..5c10a36a35 100644 --- a/widget/entry.go +++ b/widget/entry.go @@ -900,6 +900,7 @@ func (e *Entry) placeholderProvider() *RichText { style := RichTextStyleInline style.ColorName = theme.ColorNamePlaceHolder + style.TextStyle = e.TextStyle text := NewRichText(&TextSegment{ Style: style, Text: e.PlaceHolder, diff --git a/widget/entry_internal_test.go b/widget/entry_internal_test.go index bf5a212261..db56c05fc4 100644 --- a/widget/entry_internal_test.go +++ b/widget/entry_internal_test.go @@ -366,6 +366,17 @@ func TestEntry_PasteFromClipboard_MultilineWrapping(t *testing.T) { assert.Equal(t, 7, entry.CursorColumn) } +func TestEntry_PlaceholderTextStyle(t *testing.T) { + e := NewEntry() + e.TextStyle = fyne.TextStyle{Bold: true, Italic: true} + + w := test.NewWindow(e) + assert.Equal(t, e.TextStyle, e.placeholder.Segments[0].(*TextSegment).Style.TextStyle) + + w.Canvas().Focus(e) + assert.Equal(t, e.TextStyle, e.placeholder.Segments[0].(*TextSegment).Style.TextStyle) +} + func TestEntry_Tab(t *testing.T) { e := NewEntry() e.TextStyle.Monospace = true