Skip to content

Commit

Permalink
Merge pull request #4168 from Jacalz/placeholder-style-before-click
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz authored Aug 20, 2023
2 parents 1afbf23 + 1716c2b commit a4b7dc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions widget/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions widget/entry_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a4b7dc8

Please sign in to comment.