mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
io/input,io/clipboard: [API] replace WriteOp with command
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -417,7 +417,7 @@ func (e *Editor) command(gtx layout.Context, k key.Event) {
|
||||
case "C", "X":
|
||||
e.scratch = e.text.SelectedText(e.scratch)
|
||||
if text := string(e.scratch); text != "" {
|
||||
clipboard.WriteOp{Text: text}.Add(gtx.Ops)
|
||||
gtx.Queue(clipboard.WriteCmd{Type: "application/text", Data: io.NopCloser(strings.NewReader(text))})
|
||||
if k.Name == "X" && !e.ReadOnly {
|
||||
e.Delete(1)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package widget
|
||||
|
||||
import (
|
||||
"image"
|
||||
"io"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
@@ -332,7 +333,7 @@ func (e *Selectable) command(gtx layout.Context, k key.Event) {
|
||||
case "C", "X":
|
||||
e.scratch = e.text.SelectedText(e.scratch)
|
||||
if text := string(e.scratch); text != "" {
|
||||
clipboard.WriteOp{Text: text}.Add(gtx.Ops)
|
||||
gtx.Queue(clipboard.WriteCmd{Type: "application/text", Data: io.NopCloser(strings.NewReader(text))})
|
||||
}
|
||||
// Select all
|
||||
case "A":
|
||||
|
||||
Reference in New Issue
Block a user