io/input,io/key: [API] replace SnippetOp with command

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-10-09 17:08:47 -05:00
parent 813d836641
commit eed93aaffe
5 changed files with 14 additions and 38 deletions
+2 -5
View File
@@ -554,7 +554,7 @@ func (e *Editor) Layout(gtx layout.Context, lt *text.Shaper, font font.Font, siz
return e.layout(gtx, textMaterial, selectMaterial)
}
// updateSnippet adds a key.SnippetOp if the snippet content or position
// updateSnippet queues a key.SnippetCmd if the snippet content or position
// have changed. off and len are in runes.
func (e *Editor) updateSnippet(gtx layout.Context, start, end int) {
if start > end {
@@ -594,10 +594,7 @@ func (e *Editor) updateSnippet(gtx layout.Context, start, end int) {
return
}
e.ime.snippet = newSnip
key.SnippetOp{
Tag: &e.eventKey,
Snippet: newSnip,
}.Add(gtx.Ops)
gtx.Queue(key.SnippetCmd{Tag: &e.eventKey, Snippet: newSnip})
}
func (e *Editor) layout(gtx layout.Context, textMaterial, selectMaterial op.CallOp) layout.Dimensions {