Merge branch 'master' of github.com:dankamongmen/notcurses

This commit is contained in:
nick black 2020-11-09 20:54:44 -05:00
commit 0eac5a2e4a
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
5 changed files with 29 additions and 12 deletions

View File

@ -3,6 +3,8 @@ d = "doc --no-deps"
do = "doc --no-deps --open" do = "doc --no-deps --open"
re = "run --example" re = "run --example"
rqe = "run --quiet --example "
req = "rqe"
# TEST # TEST
# fix IO errors: https://github.com/dankamongmen/notcurses/issues/766 # fix IO errors: https://github.com/dankamongmen/notcurses/issues/766

View File

@ -1,5 +1,4 @@
#[allow(unused_imports)] #[allow(unused_imports)]
use crate::Cell; use crate::Cell;
// Cell ------------------------------------------------------------------------ // Cell ------------------------------------------------------------------------
@ -60,4 +59,3 @@ macro_rules! cell_trivial_initializer {
// #define PREFIXFMT(x) NCMETRICFWIDTH((x), PREFIXCOLUMNS), (x) // #define PREFIXFMT(x) NCMETRICFWIDTH((x), PREFIXCOLUMNS), (x)
// #define IPREFIXFMT(x) NCMETRIXFWIDTH((x), IPREFIXCOLUMNS), (x) // #define IPREFIXFMT(x) NCMETRIXFWIDTH((x), IPREFIXCOLUMNS), (x)
// #define BPREFIXFMT(x) NCMETRICFWIDTH((x), BPREFIXCOLUMNS), (x) // #define BPREFIXFMT(x) NCMETRICFWIDTH((x), BPREFIXCOLUMNS), (x)

View File

@ -63,9 +63,10 @@ use crate::{
notcurses_init, notcurses_init,
notcurses_stdplane, notcurses_stdplane,
notcurses_stdplane_const, notcurses_stdplane_const,
types::{NcAlign, NcInput, NcLogLevel, NcPlane, Notcurses, NotcursesOptions}, types::{
NCALIGN_CENTER, NcAlign, NcInput, NcLogLevel, NcPlane, Notcurses, NotcursesOptions, NCALIGN_CENTER,
NCALIGN_LEFT, NCALIGN_LEFT, NCOPTION_SUPPRESS_BANNERS,
},
}; };
impl NotcursesOptions { impl NotcursesOptions {
@ -104,10 +105,17 @@ impl NotcursesOptions {
/// ///
/// - flags /// - flags
/// ///
/// General flags; see NCOPTION_*. This is expressed as a bitfield so that /// General flags; This is expressed as a bitfield so that future options
/// future options can be added without reshaping the struct. /// can be added without reshaping the struct.
/// Undefined bits must be set to 0. /// Undefined bits must be set to 0.
/// ///
/// - [`NCOPTION_INHIBIT_SETLOCALE`](type.NCOPTION_INHIBIT_SETLOCALE.html)
/// - [`NCOPTION_NO_ALTERNATE_SCREEN`](type.NCOPTION_NO_ALTERNATE_SCREEN.html)
/// - [`NCOPTION_NO_FONT_CHANGES`](type.NCOPTION_NO_FONT_CHANGES.html)
/// - [`NCOPTION_NO_QUIT_SIGHANDLERS`](type.NCOPTION_NO_QUIT_SIGHANDLERS.html)
/// - [`NCOPTION_NO_WINCH_SIGHANDLER`](type.NCOPTION_NO_WINCH_SIGHANDLER.html)
/// - [`NCOPTION_SUPPRESS_BANNERS`](type.NCOPTION_SUPPRESS_BANNERS.html)
///
pub fn with_all_options( pub fn with_all_options(
loglevel: NcLogLevel, loglevel: NcLogLevel,
margin_t: i32, margin_t: i32,
@ -130,13 +138,19 @@ impl NotcursesOptions {
} }
impl Notcurses { impl Notcurses {
/// `Notcurses` simple constructor /// `Notcurses` simple constructor with clean output
pub unsafe fn new<'a>() -> &'a mut Notcurses { pub unsafe fn new<'a>() -> &'a mut Notcurses {
let options = NotcursesOptions::with_flags(NCOPTION_SUPPRESS_BANNERS);
&mut *notcurses_init(&options, null_mut())
}
/// `Notcurses` simple constructor, showing banners
pub unsafe fn with_banners<'a>() -> &'a mut Notcurses {
&mut *notcurses_init(&NotcursesOptions::new(), null_mut()) &mut *notcurses_init(&NotcursesOptions::new(), null_mut())
} }
/// `Notcurses` constructor with options /// `Notcurses` constructor with options
pub unsafe fn with_options(options: &NotcursesOptions) -> &mut Notcurses { pub unsafe fn with_options<'a>(options: &NotcursesOptions) -> &'a mut Notcurses {
&mut *notcurses_init(options, null_mut()) &mut *notcurses_init(options, null_mut())
} }
} }

View File

@ -1,5 +1,5 @@
//! Miscellaneous types and constants //! Miscellaneous types and constants
//! //!
// error handling -------------------------------------------------------------- // error handling --------------------------------------------------------------

View File

@ -31,7 +31,8 @@ pub use channel::{
CHANNEL_ALPHA_MASK, CHANNEL_ALPHA_MASK,
}; };
pub use misc::{ pub use misc::{
IntResult, PREFIXCOLUMNS, BPREFIXCOLUMNS, IPREFIXCOLUMNS, PREFIXSTRLEN, BPREFIXSTRLEN, IPREFIXSTRLEN IntResult, BPREFIXCOLUMNS, BPREFIXSTRLEN, IPREFIXCOLUMNS, IPREFIXSTRLEN, PREFIXCOLUMNS,
PREFIXSTRLEN,
}; };
pub use plane::{ pub use plane::{
NCBLIT_1x1, NCBLIT_2x1, NCBLIT_2x2, NCBLIT_3x2, NCBLIT_4x1, NCBLIT_8x1, NcAlign, NcBlitter, NCBLIT_1x1, NCBLIT_2x1, NCBLIT_2x2, NCBLIT_3x2, NCBLIT_4x1, NCBLIT_8x1, NcAlign, NcBlitter,
@ -42,7 +43,9 @@ pub use plane::{
}; };
pub use terminal::{ pub use terminal::{
NcDirect, NcDirectFlags, NcInput, NcLogLevel, Notcurses, NotcursesOptions, NcDirect, NcDirectFlags, NcInput, NcLogLevel, Notcurses, NotcursesOptions,
NCDIRECT_OPTION_INHIBIT_CBREAK, NCDIRECT_OPTION_INHIBIT_SETLOCALE, NCOPTION_INHIBIT_SETLOCALE, NCDIRECT_OPTION_INHIBIT_CBREAK, NCDIRECT_OPTION_INHIBIT_SETLOCALE, NCLOGLEVEL_DEBUG,
NCLOGLEVEL_ERROR, NCLOGLEVEL_FATAL, NCLOGLEVEL_INFO, NCLOGLEVEL_PANIC, NCLOGLEVEL_SILENT,
NCLOGLEVEL_TRACE, NCLOGLEVEL_VERBOSE, NCLOGLEVEL_WARNING, NCOPTION_INHIBIT_SETLOCALE,
NCOPTION_NO_ALTERNATE_SCREEN, NCOPTION_NO_FONT_CHANGES, NCOPTION_NO_QUIT_SIGHANDLERS, NCOPTION_NO_ALTERNATE_SCREEN, NCOPTION_NO_FONT_CHANGES, NCOPTION_NO_QUIT_SIGHANDLERS,
NCOPTION_NO_WINCH_SIGHANDLER, NCOPTION_SUPPRESS_BANNERS, NCOPTION_VERIFY_SIXEL, NCOPTION_NO_WINCH_SIGHANDLER, NCOPTION_SUPPRESS_BANNERS, NCOPTION_VERIFY_SIXEL,
}; };