mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
chore(java): try_recv async
This commit is contained in:
parent
a9d713fd75
commit
bd6423856b
2 changed files with 4 additions and 3 deletions
|
@ -41,7 +41,7 @@ pub extern "system" fn Java_mp_code_BufferController_try_1recv(
|
||||||
self_ptr: jlong,
|
self_ptr: jlong,
|
||||||
) -> jobject {
|
) -> jobject {
|
||||||
let controller = unsafe { Box::leak(Box::from_raw(self_ptr as *mut crate::buffer::Controller)) };
|
let controller = unsafe { Box::leak(Box::from_raw(self_ptr as *mut crate::buffer::Controller)) };
|
||||||
let change = controller.try_recv().jexcept(&mut env);
|
let change = RT.block_on(controller.try_recv()).jexcept(&mut env);
|
||||||
recv_jni(&mut env, change)
|
recv_jni(&mut env, change)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,8 @@ pub extern "system" fn Java_mp_code_BufferController_send<'local>(
|
||||||
controller.send(crate::api::TextChange {
|
controller.send(crate::api::TextChange {
|
||||||
start: start as u32,
|
start: start as u32,
|
||||||
end: end as u32,
|
end: end as u32,
|
||||||
content
|
content,
|
||||||
|
hash: None
|
||||||
}).jexcept(&mut env);
|
}).jexcept(&mut env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ pub extern "system" fn Java_mp_code_CursorController_try_1recv(
|
||||||
self_ptr: jlong,
|
self_ptr: jlong,
|
||||||
) -> jobject {
|
) -> jobject {
|
||||||
let controller = unsafe { Box::leak(Box::from_raw(self_ptr as *mut crate::cursor::Controller)) };
|
let controller = unsafe { Box::leak(Box::from_raw(self_ptr as *mut crate::cursor::Controller)) };
|
||||||
let cursor = controller.try_recv().jexcept(&mut env);
|
let cursor = RT.block_on(controller.try_recv()).jexcept(&mut env);
|
||||||
jni_recv(&mut env, cursor)
|
jni_recv(&mut env, cursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue