mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
widget: defer op.StackOp in Editor.PaintCaret
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-2
@@ -423,7 +423,7 @@ func (e *Editor) PaintCaret(gtx layout.Context) {
|
|||||||
carX := e.caret.x
|
carX := e.caret.x
|
||||||
carY := e.caret.y
|
carY := e.caret.y
|
||||||
|
|
||||||
stack := op.Push(gtx.Ops)
|
defer op.Push(gtx.Ops).Pop()
|
||||||
carX -= carWidth / 2
|
carX -= carWidth / 2
|
||||||
carAsc, carDesc := -e.lines[e.caret.line].Bounds.Min.Y, e.lines[e.caret.line].Bounds.Max.Y
|
carAsc, carDesc := -e.lines[e.caret.line].Bounds.Min.Y, e.lines[e.caret.line].Bounds.Max.Y
|
||||||
carRect := image.Rectangle{
|
carRect := image.Rectangle{
|
||||||
@@ -448,7 +448,6 @@ func (e *Editor) PaintCaret(gtx layout.Context) {
|
|||||||
if !carRect.Empty() {
|
if !carRect.Empty() {
|
||||||
paint.PaintOp{Rect: layout.FRect(carRect)}.Add(gtx.Ops)
|
paint.PaintOp{Rect: layout.FRect(carRect)}.Add(gtx.Ops)
|
||||||
}
|
}
|
||||||
stack.Pop()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Len is the length of the editor contents.
|
// Len is the length of the editor contents.
|
||||||
|
|||||||
Reference in New Issue
Block a user