From 713770f808fec742b5ef8524bc6857ae49d2d480 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 9 Jul 2020 20:34:15 +0200 Subject: [PATCH] widget: defer op.StackOp in Editor.PaintCaret Signed-off-by: Elias Naur --- widget/editor.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/widget/editor.go b/widget/editor.go index ef8b1655..7e8fddb9 100644 --- a/widget/editor.go +++ b/widget/editor.go @@ -423,7 +423,7 @@ func (e *Editor) PaintCaret(gtx layout.Context) { carX := e.caret.x carY := e.caret.y - stack := op.Push(gtx.Ops) + defer op.Push(gtx.Ops).Pop() carX -= carWidth / 2 carAsc, carDesc := -e.lines[e.caret.line].Bounds.Min.Y, e.lines[e.caret.line].Bounds.Max.Y carRect := image.Rectangle{ @@ -448,7 +448,6 @@ func (e *Editor) PaintCaret(gtx layout.Context) { if !carRect.Empty() { paint.PaintOp{Rect: layout.FRect(carRect)}.Add(gtx.Ops) } - stack.Pop() } // Len is the length of the editor contents.