all: replace InvalidateOp with InvalidateCmd command

Curiously, InvalidateCmd is probably the only command that is appropriate
to call during layout.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-11-25 13:57:15 -06:00
parent 0fab08bd6c
commit c515b7804e
9 changed files with 31 additions and 51 deletions
+1 -2
View File
@@ -692,8 +692,7 @@ func (e *Editor) layout(gtx layout.Context, textMaterial, selectMaterial op.Call
const timePerBlink = time.Second / blinksPerSecond
nextBlink := now.Add(timePerBlink/2 - dt%(timePerBlink/2))
if blinking {
redraw := op.InvalidateOp{At: nextBlink}
redraw.Add(gtx.Ops)
gtx.Execute(op.InvalidateCmd{At: nextBlink})
}
e.showCaret = e.focused && (!blinking || dt%timePerBlink < timePerBlink/2)
}