app: [Android] sanitize IME snippet bounds

Fixes: https://todo.sr.ht/~eliasnaur/gio/473
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-01-27 20:36:12 -06:00
parent e0cf570339
commit ac2c284d16
+6
View File
@@ -1062,6 +1062,12 @@ func Java_org_gioui_GioView_imeSnippetStart(env *C.JNIEnv, class C.jclass, handl
//export Java_org_gioui_GioView_imeSetSnippet
func Java_org_gioui_GioView_imeSetSnippet(env *C.JNIEnv, class C.jclass, handle C.jlong, start, end C.jint) {
w := cgo.Handle(handle).Value().(*window)
if start < 0 {
start = 0
}
if end < start {
end = start
}
r := key.Range{Start: int(start), End: int(end)}
w.callbacks.SetEditorSnippet(r)
}