diff --git a/rust/.cargo/config.toml b/rust/.cargo/config.toml index bfd698fcf..30c4f9094 100644 --- a/rust/.cargo/config.toml +++ b/rust/.cargo/config.toml @@ -3,6 +3,8 @@ d = "doc --no-deps" do = "doc --no-deps --open" re = "run --example" +rqe = "run --quiet --example " +req = "rqe" # TEST # fix IO errors: https://github.com/dankamongmen/notcurses/issues/766 diff --git a/rust/src/macros.rs b/rust/src/macros.rs index 035283cfb..20d3f9c30 100644 --- a/rust/src/macros.rs +++ b/rust/src/macros.rs @@ -1,5 +1,4 @@ #[allow(unused_imports)] - use crate::Cell; // Cell ------------------------------------------------------------------------ @@ -60,4 +59,3 @@ macro_rules! cell_trivial_initializer { // #define PREFIXFMT(x) NCMETRICFWIDTH((x), PREFIXCOLUMNS), (x) // #define IPREFIXFMT(x) NCMETRIXFWIDTH((x), IPREFIXCOLUMNS), (x) // #define BPREFIXFMT(x) NCMETRICFWIDTH((x), BPREFIXCOLUMNS), (x) - diff --git a/rust/src/notcurses.rs b/rust/src/notcurses.rs index 2b6b447a8..c5a568bc1 100644 --- a/rust/src/notcurses.rs +++ b/rust/src/notcurses.rs @@ -63,9 +63,10 @@ use crate::{ notcurses_init, notcurses_stdplane, notcurses_stdplane_const, - types::{NcAlign, NcInput, NcLogLevel, NcPlane, Notcurses, NotcursesOptions}, - NCALIGN_CENTER, - NCALIGN_LEFT, + types::{ + NcAlign, NcInput, NcLogLevel, NcPlane, Notcurses, NotcursesOptions, NCALIGN_CENTER, + NCALIGN_LEFT, NCOPTION_SUPPRESS_BANNERS, + }, }; impl NotcursesOptions { @@ -104,10 +105,17 @@ impl NotcursesOptions { /// /// - flags /// - /// General flags; see NCOPTION_*. This is expressed as a bitfield so that - /// future options can be added without reshaping the struct. + /// General flags; This is expressed as a bitfield so that future options + /// can be added without reshaping the struct. /// 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( loglevel: NcLogLevel, margin_t: i32, @@ -130,13 +138,19 @@ impl NotcursesOptions { } impl Notcurses { - /// `Notcurses` simple constructor + /// `Notcurses` simple constructor with clean output 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()) } /// `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()) } } diff --git a/rust/src/types/misc.rs b/rust/src/types/misc.rs index 10befa087..cff8892df 100644 --- a/rust/src/types/misc.rs +++ b/rust/src/types/misc.rs @@ -1,5 +1,5 @@ //! Miscellaneous types and constants -//! +//! // error handling -------------------------------------------------------------- diff --git a/rust/src/types/mod.rs b/rust/src/types/mod.rs index 645c03219..1a087d502 100644 --- a/rust/src/types/mod.rs +++ b/rust/src/types/mod.rs @@ -31,7 +31,8 @@ pub use channel::{ CHANNEL_ALPHA_MASK, }; pub use misc::{ - IntResult, PREFIXCOLUMNS, BPREFIXCOLUMNS, IPREFIXCOLUMNS, PREFIXSTRLEN, BPREFIXSTRLEN, IPREFIXSTRLEN + IntResult, BPREFIXCOLUMNS, BPREFIXSTRLEN, IPREFIXCOLUMNS, IPREFIXSTRLEN, PREFIXCOLUMNS, + PREFIXSTRLEN, }; pub use plane::{ NCBLIT_1x1, NCBLIT_2x1, NCBLIT_2x2, NCBLIT_3x2, NCBLIT_4x1, NCBLIT_8x1, NcAlign, NcBlitter, @@ -42,7 +43,9 @@ pub use plane::{ }; pub use terminal::{ 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_WINCH_SIGHANDLER, NCOPTION_SUPPRESS_BANNERS, NCOPTION_VERIFY_SIXEL, };