mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
widget/material: fix hint when Editor is single-line
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
@@ -43,7 +43,11 @@ func (e EditorStyle) Layout(gtx layout.Context) layout.Dimensions {
|
|||||||
defer op.Push(gtx.Ops).Pop()
|
defer op.Push(gtx.Ops).Pop()
|
||||||
macro := op.Record(gtx.Ops)
|
macro := op.Record(gtx.Ops)
|
||||||
paint.ColorOp{Color: e.HintColor}.Add(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)
|
dims := tl.Layout(gtx, e.shaper, e.Font, e.TextSize, e.Hint)
|
||||||
call := macro.Stop()
|
call := macro.Stop()
|
||||||
if w := dims.Size.X; gtx.Constraints.Min.X < w {
|
if w := dims.Size.X; gtx.Constraints.Min.X < w {
|
||||||
|
|||||||
Reference in New Issue
Block a user