mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-08 10:55:35 +00:00
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:
@@ -1062,6 +1062,12 @@ func Java_org_gioui_GioView_imeSnippetStart(env *C.JNIEnv, class C.jclass, handl
|
|||||||
//export Java_org_gioui_GioView_imeSetSnippet
|
//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) {
|
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)
|
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)}
|
r := key.Range{Start: int(start), End: int(end)}
|
||||||
w.callbacks.SetEditorSnippet(r)
|
w.callbacks.SetEditorSnippet(r)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user