- add ncdirect_canget_cursor
- made ncplane_notcurses require a non-mutable reference.
pull/1792/head
joseLuís 3 years ago
parent 9f8a00560c
commit 391c58e4ed

@ -162,6 +162,7 @@ pub use ffi::{
pub use ffi::{ pub use ffi::{
// functions // functions
ncdirect_box, ncdirect_box,
ncdirect_canget_cursor,
ncdirect_canopen_images, ncdirect_canopen_images,
ncdirect_canutf8, ncdirect_canutf8,
ncdirect_check_pixel_support, ncdirect_check_pixel_support,

@ -93,7 +93,14 @@ impl NcDirect {
max_x: NcDim, max_x: NcDim,
) -> NcResult<&'a mut NcDirectV> { ) -> NcResult<&'a mut NcDirectV> {
let res = unsafe { let res = unsafe {
crate::ncdirect_render_frame(self, cstring![filename], blitter, scale, max_y as i32, max_x as i32) crate::ncdirect_render_frame(
self,
cstring![filename],
blitter,
scale,
max_y as i32,
max_x as i32,
)
}; };
error_ref_mut![ error_ref_mut![
res, res,
@ -276,6 +283,14 @@ impl NcDirect {
/// ## NcDirect methods: capabilities, cursor, dimensions /// ## NcDirect methods: capabilities, cursor, dimensions
impl NcDirect { impl NcDirect {
/// Is there support for acquiring the cursor's current position?
///
/// Requires the u7 terminfo capability, and that we are connected to an
/// actual terminal.
pub fn canget_cursor(&self) -> bool {
unsafe { crate::ncdirect_canget_cursor(self) }
}
/// Can we reliably use Unicode braille? /// Can we reliably use Unicode braille?
/// ///
/// *C style function: [ncdirect_canbraille()][crate::ncdirect_canbraille].* /// *C style function: [ncdirect_canbraille()][crate::ncdirect_canbraille].*

@ -1,15 +1,15 @@
//! `NcDirect` //! `NcDirect`
// total: 61 // total: 62
// --------------------------------------------------- // ---------------------------------------------------
// (X) 1 : wont do // (X) 1 : wont do
// (~) 3 : TODO / WIP // (~) 3 : TODO / WIP
// //
// (f) 45 : unsafe ffi function exported by bindgen // (f) 46 : unsafe ffi function exported by bindgen
// (w) 1 : safely wrapped ffi function // (w) 1 : safely wrapped ffi function
// (r) 11 : static function manually reimplemented // (r) 11 : static function manually reimplemented
// //
// (m) 45 : method implemented // (m) 55 : method implemented
// //
// (t) 0 : unit test done for the function // (t) 0 : unit test done for the function
// (T) 0 : unit test done also for the method // (T) 0 : unit test done also for the method
@ -18,14 +18,15 @@
// fm ncdirect_bg_palindex // fm ncdirect_bg_palindex
// fm ncdirect_bg_rgb // fm ncdirect_bg_rgb
// fm ncdirect_box // fm ncdirect_box
// r ncdirect_canbraille // rm ncdirect_canbraille
// r ncdirect_canchangecolor // rm ncdirect_canchangecolor
// r ncdirect_canfade // fm ncdirect_canget_cursor
// r ncdirect_canhalfblock // rm ncdirect_canfade
// rm ncdirect_canhalfblock
// fm ncdirect_canopen_images // fm ncdirect_canopen_images
// rm ncdirect_canopen_videos // rm ncdirect_canopen_videos
// r ncdirect_canquadrant // rm ncdirect_canquadrant
// r ncdirect_cantruecolor // rm ncdirect_cantruecolor
// fm ncdirect_canutf8 // fm ncdirect_canutf8
// wm ncdirect_capabilities // wm ncdirect_capabilities
// fm ncdirect_check_pixel_support // fm ncdirect_check_pixel_support
@ -41,7 +42,7 @@
// fm ncdirect_cursor_right // fm ncdirect_cursor_right
// fm ncdirect_cursor_up // fm ncdirect_cursor_up
// fm ncdirect_cursor_yx // fm ncdirect_cursor_yx
// ncdirect_detected_terminal // fm ncdirect_detected_terminal
// fm ncdirect_dim_x // fm ncdirect_dim_x
// fm ncdirect_dim_y // fm ncdirect_dim_y
// fm ncdirect_double_box // fm ncdirect_double_box

@ -1171,7 +1171,7 @@ impl NcPlane {
/// Gets a mutable reference to the [`Nc`] context of this NcPlane. /// Gets a mutable reference to the [`Nc`] context of this NcPlane.
/// ///
/// *C style function: [ncplane_notcurses()][crate::ncplane_notcurses].* /// *C style function: [ncplane_notcurses()][crate::ncplane_notcurses].*
pub fn notcurses<'a>(&mut self) -> NcResult<&'a mut Nc> { pub fn notcurses<'a>(&self) -> NcResult<&'a mut Nc> {
error_ref_mut![ error_ref_mut![
unsafe { crate::ncplane_notcurses(self) }, unsafe { crate::ncplane_notcurses(self) },
"NcPlane.notcurses()" "NcPlane.notcurses()"

Loading…
Cancel
Save