From fc79dcd77a03b4f13241b3218362e10b82ac78e8 Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 27 Mar 2021 01:42:49 -0400 Subject: [PATCH] update rust for halign/valign #1468 --- rust/src/plane/mod.rs | 9 +++++---- rust/src/plane/reimplemented.rs | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/rust/src/plane/mod.rs b/rust/src/plane/mod.rs index d13ccb610..bd53254a4 100644 --- a/rust/src/plane/mod.rs +++ b/rust/src/plane/mod.rs @@ -116,14 +116,13 @@ //W ncplane_y //W ncplane_yx // -// functions manually reimplemented: 39 +// functions manually reimplemented: 40 // ------------------------------------------ // (X) wont: 9 -// (+) done: 32 / 0 -// (W) wrap: 24 +// (+) done: 33 / 0 +// (W) wrap: 25 // (#) test: 5 // ------------------------------------------ -//W+ ncplane_align //W+ ncplane_bchannel //W+ ncplane_bg_alpha //W# ncplane_bg_default_p @@ -140,6 +139,7 @@ //W+ ncplane_fg_rgb //W+ ncplane_fg_rgb8 //W+ ncplane_gradient_sized +//W+ ncplane_halign // + ncplane_hline //W+ ncplane_perimeter //W+ ncplane_perimeter_double @@ -161,6 +161,7 @@ //W# ncplane_resize_simple // + ncplane_rounded_box // + ncplane_rounded_box_sized +//W+ ncplane_halign // + ncplane_vline // + ncplane_vprintf // diff --git a/rust/src/plane/reimplemented.rs b/rust/src/plane/reimplemented.rs index 74403c40a..404308ed6 100644 --- a/rust/src/plane/reimplemented.rs +++ b/rust/src/plane/reimplemented.rs @@ -247,10 +247,22 @@ pub fn ncplane_resize_simple(plane: &mut NcPlane, y_len: NcDim, x_len: NcDim) -> /// Returns `-`[`NCRESULT_MAX`][crate::NCRESULT_MAX] if /// [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] or invalid [NcAlign]. /// -/// *Method: NcPlane.[align()][NcPlane#method.align].* +/// *Method: NcPlane.[halign()][NcPlane#method.halign].* #[inline] -pub fn ncplane_align(plane: &NcPlane, align: NcAlign, cols: NcDim) -> NcIntResult { - crate::notcurses_align(ncplane_dim_x(plane), align, cols) +pub fn ncplane_halign(plane: &NcPlane, align: NcAlign, cols: NcDim) -> NcIntResult { + crate::notcurses_halign(ncplane_dim_x(plane), align, cols) +} + +/// Returns the row at which `rows` rows ought start in order to be aligned +/// according to `align` within this NcPlane. +/// +/// Returns `-`[`NCRESULT_MAX`][crate::NCRESULT_MAX] if +/// [NCALIGN_UNALIGNED][crate::NCALIGN_UNALIGNED] or invalid [NcAlign]. +/// +/// *Method: NcPlane.[valign()][NcPlane#method.valign].* +#[inline] +pub fn ncplane_valign(plane: &NcPlane, align: NcAlign, rows: NcDim) -> NcIntResult { + crate::notcurses_valign(ncplane_dim_y(plane), align, rows) } // line ------------------------------------------------------------------------