From 3c45a6d4203b288e0f4fc0c7fc23a5428f9656aa Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 23 Apr 2022 15:45:41 +0200 Subject: [PATCH] widget: don't draw Editor selection when not focused Signed-off-by: Elias Naur --- widget/editor.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/widget/editor.go b/widget/editor.go index cf530f36..684520ec 100644 --- a/widget/editor.go +++ b/widget/editor.go @@ -649,6 +649,9 @@ func (e *Editor) layout(gtx layout.Context, content layout.Widget) layout.Dimens // PaintSelection paints the contrasting background for selected text. func (e *Editor) PaintSelection(gtx layout.Context) { + if !e.focused { + return + } cl := textPadding(e.lines) cl.Max = cl.Max.Add(e.viewSize) defer clip.Rect(cl).Push(gtx.Ops).Pop()