From dd86c9706f5d6db676f33821e3785c30172112aa Mon Sep 17 00:00:00 2001 From: Inkeliz Date: Mon, 7 Jun 2021 13:32:20 +0100 Subject: [PATCH] widget: add key.InputHint to widget.Editor Signed-off-by: Inkeliz --- widget/editor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/widget/editor.go b/widget/editor.go index 2de55374..a483ee9d 100644 --- a/widget/editor.go +++ b/widget/editor.go @@ -45,6 +45,8 @@ type Editor struct { // Newline characters are not masked. When non-zero, the unmasked contents // are accessed by Len, Text, and SetText. Mask rune + // InputHint specifies the type of on-screen keyboard to be displayed. + InputHint key.InputHint eventKey int font text.Font @@ -67,7 +69,7 @@ type Editor struct { on bool scroll bool // start is the current caret position, and also the start position of - // selected text. end is the end positon of selected text. If start.ofs + // selected text. end is the end position of selected text. If start.ofs // == end.ofs, then there's no selection. Note that it's possible (and // common) that the caret (start) is after the end, e.g. after // Shift-DownArrow. @@ -533,7 +535,7 @@ func (e *Editor) layout(gtx layout.Context) layout.Dimensions { e.shapes = append(e.shapes, line{off, path, selected, yOffs, size}) } - key.InputOp{Tag: &e.eventKey}.Add(gtx.Ops) + key.InputOp{Tag: &e.eventKey, Hint: e.InputHint}.Add(gtx.Ops) if e.requestFocus { key.FocusOp{Tag: &e.eventKey}.Add(gtx.Ops) key.SoftKeyboardOp{Show: true}.Add(gtx.Ops)