widget/material: fix hint when Editor is single-line

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
Inkeliz
2020-11-17 22:48:47 +00:00
committed by Elias Naur
parent 01e8308a83
commit 9469d18907
+5 -1
View File
@@ -43,7 +43,11 @@ func (e EditorStyle) Layout(gtx layout.Context) layout.Dimensions {
defer op.Push(gtx.Ops).Pop()
macro := op.Record(gtx.Ops)
paint.ColorOp{Color: e.HintColor}.Add(gtx.Ops)
tl := widget.Label{Alignment: e.Editor.Alignment}
var maxlines int
if e.Editor.SingleLine {
maxlines = 1
}
tl := widget.Label{Alignment: e.Editor.Alignment, MaxLines: maxlines}
dims := tl.Layout(gtx, e.shaper, e.Font, e.TextSize, e.Hint)
call := macro.Stop()
if w := dims.Size.X; gtx.Constraints.Min.X < w {