From b2d10c2f28ef298c1ce9eff9ca89a2f5236fcf31 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 30 Mar 2022 13:18:01 +0200 Subject: [PATCH] widget: include the Editor key handler in the editor clip area A meaningful clip area for a key handler will matter when we start auto-scrolling to move focused handlers into view. Signed-off-by: Elias Naur --- widget/editor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widget/editor.go b/widget/editor.go index e373319b..ff3b1d19 100644 --- a/widget/editor.go +++ b/widget/editor.go @@ -623,14 +623,14 @@ func (e *Editor) layout(gtx layout.Context, content layout.Widget) layout.Dimens e.scrollToCaret() } + defer clip.Rect(image.Rectangle{Max: e.viewSize}).Push(gtx.Ops).Pop() + pointer.CursorText.Add(gtx.Ops) key.InputOp{Tag: &e.eventKey, Hint: e.InputHint}.Add(gtx.Ops) if e.requestFocus { key.FocusOp{Tag: &e.eventKey}.Add(gtx.Ops) key.SoftKeyboardOp{Show: true}.Add(gtx.Ops) } e.requestFocus = false - defer clip.Rect(image.Rectangle{Max: e.viewSize}).Push(gtx.Ops).Pop() - pointer.CursorText.Add(gtx.Ops) var scrollRange image.Rectangle if e.SingleLine {