Type Definition libnotcurses_sys::Nc [−][src]
pub type Nc = notcurses;
Expand description
Notcurses state for a given terminal, composed of NcPlane
s.
It’s built atop the terminfo abstraction layer to provide reasonably portable vivid character displays.
Implementations
New notcurses context in CLI mode.
It has the following flags:
NcOptions::SUPPRESS_BANNERS
NcOptions::NO_ALTERNATE_SCREEN
NcOptions::NO_CLEAR_BITMAPS
NcOptions::PRESERVE_CURSOR
Safety
You must not create multiple Nc
instances at the same time, on
the same thread. You must stop
the current one
before creating a new one.
New notcurses context, expects NcLogLevel and flags.
Safety
You must not create multiple Nc
instances at the same time, on
the same thread. You must stop
the current one
before creating a new one.
Returns the offset into availcols
at which cols
ought be output given
the requirements of align
.
Returns -
NcIntResult::MAX if
NcAlign::Unaligned
.
C style function: notcurses_align().
Retrieves the current contents of the specified NcCell
as last rendered, returning the EGC
(or None on error) and writing
out the NcStyle
and the NcChannels
.
C style function: notcurses_at_yx().
Returns NcCapabilities
.
C style function: notcurses_capabilities().
Returns true if we can reliably use Unicode Braille.
See also NcBlitter::Braille
.
C style function: notcurses_canbraille().
Returns true if it’s possible to set the “hardware” palette.
Requires the “ccc” terminfo capability.
C style function: notcurses_canchangecolor().
Returns true if fading is possible.
Fading requires either the “rgb” or “ccc” terminfo capability.
C style function: notcurses_canfade().
Returns true if we can reliably use Unicode half blocks.
See also NcBlitter::Half
.
C style function: notcurses_canhalfblock().
Returns true if loading images is possible.
This requires being built against FFmpeg/OIIO.
C style function: notcurses_canopen_images().
Returns true if loading videos is possible.
This requires being built against FFmpeg.
C style function: notcurses_canopen_videos().
Returns true if we can blit pixel-accurate bitmaps.
See also check_pixel_support
.
C style function: notcurses_canpixel().
Returns true if we can reliably use Unicode quadrant blocks.
See also NcBlitter::Quadrant
.
C style function: notcurses_canquadrant().
Returns true if we can reliably use Unicode 13 sextants.
See also NcBlitter::Sextant
.
C style function: notcurses_cansextant().
Returns true if it’s possible to directly specify RGB values per cell, or false if it’s only possible to use palettes.
C style function: notcurses_cantruecolor().
Returns true if the encoding is UTF-8.
Requires LANG
being set to a UTF-8 locale.
C style function: notcurses_canutf8().
Checks for pixel support.
Returns NcPixelImpl
with a non-zero constant corresponding to some
pixel-blitting mechanism if bitmap support (via any mechanism) has been
detected, or else 0 (NCPIXEL_NONE).
C style function: [notcurses_check_pixel_support()][c_api::notcurses_check-pixel_support].
Returns the default foreground color, if it is known.
Returns the default background color, if it is known.
Disables the terminal’s cursor, if supported.
Immediate effect (no need for a call to notcurses_render()).
C style function: notcurses_cursor_disable().
Enables the terminal’s cursor, if supported, placing it at y
, x
.
Immediate effect (no need for a call to notcurses_render()).
It is an error if y
, x
lies outside the standard plane.
C style function: notcurses_cursor_enable().
Shifts to the alternate screen, if available.
If already using the alternate screen, this returns Ok(()) immediately.
If the alternate screen is not available, returns an Error immediately.
Entering the alternate screen turns off scrolling for the standard plane.
C style function: notcurses_enter_alternate_screen().
Exits the alternate screen.
Immediately returns Ok(()) if not currently using the alternate screen.
C style function: notcurses_leave_alternate_screen().
Dumps notcurses state to the supplied debugfp
.
Output is freeform, and subject to change. It includes geometry of all planes, from all piles.
C style function: notcurses_debug().
Returns the name of the user under which we are running.
C style function: notcurses_accountname().
Returns the name of the local hostname.
C style function: notcurses_hostname().
Returns the name of the detected terminal.
C style function: notcurses_detected_terminal().
Returns the name of the detected OS version.
C style function: notcurses_osversion().
Destroys all NcPlane
s other than the stdplane.
C style function: notcurses_drop_planes().
Gets an NcReceived
from input.
Provide None
in time
to block at length, and otherwise
Some(
NcTime
)
to bound blocking.
time
is an a delay bound against CLOCK_MONOTONIC
(see pthread_cond_clockwait(3)).
C style function: notcurses_get().
Reads input blocking until an event is processed or a signal is received.
Will optionally write the event details in input
.
In the case of a valid read, a char
is returned.
C style function: notcurses_get_blocking().
Reads input without blocking.
In the case of a valid read, a char
is returned.
If no event is ready, returns 0.
C style function: notcurses_get_nblock().
Acquire up to ‘vcount’ NcInput
s at the vector ‘ni’.
The number read will be returned, or 0 on timeout.
C style function: notcurses_getvec().
Gets a file descriptor suitable for input event poll()ing.
When this descriptor becomes available, you can call get_nblock(), and input ought be ready.
This file descriptor is not necessarily the file descriptor associated with stdin (but it might be!).
C style function: notcurses_inputready_fd().
Returns an NcBlitter
from a string representation.
C style function: notcurses_lex_blitter().
Lexes a margin argument according to the standard notcurses definition.
There can be either a single number, which will define all margins equally, or there can be four numbers separated by commas.
C style function: notcurses_lex_margins().
Returns an NcScale
from a string representation.
C style function: notcurses_lex_scalemode().
Returns an NcStyle
from a string representation.
It is case-insensitive, and supports multiple styles separated by spaces.
The supported styles are: italic
, underline
, undercurl
,
struck
, bold
, and none
.
If a style is are not recognized returns an error.
(No equivalent C style function)
Disables signals originating from the terminal’s line discipline, i.e. SIGINT (^C), SIGQUIT (^), and SIGTSTP (^Z). They are enabled by default.
C style function: notcurses_linesigs_disable().
Restores signals originating from the terminal’s line discipline, i.e. SIGINT (^C), SIGQUIT (^), and SIGTSTP (^Z), if disabled.
C style function: notcurses_linesigs_enable().
Disables mice events.
C style function: notcurses_mice_disable().
Enables mice events according to eventmask
.
An eventmask of 0 will disable all mice tracking.
On success mouse events will be published to notcurses_get
.
C style function: notcurses_mice_enable().
Returns the number of simultaneous colors claimed to be supported, if there is color support.
Note that several terminal emulators advertise more colors than they actually support, downsampling internally.
C style function: notcurses_palette_size().
Refreshes the physical screen to match what was last rendered (i.e.,
without reflecting any changes since the last call to
render
).
Returns the current screen geometry (y
, x
).
This is primarily useful if the screen is externally corrupted, or if an NcKey::RESIZE event has been read and you’re not yet ready to render.
C style function: notcurses_refresh().
Renders and rasterizes the standard pile in one shot. Blocking call.
C style function: notcurses_render().
Acquires an atomic snapshot of the notcurses object’s stats.
C style function: notcurses_stats().
Allocates an NcStats
object.
Use this rather than allocating your own, since future versions of notcurses might enlarge this structure.
C style function: notcurses_stats_alloc().
Resets all cumulative stats (immediate ones, such as fbbytes, are not reset).
C style function: notcurses_stats_reset().
Returns a mutable reference to the standard NcPlane
for this terminal.
The standard plane always exists, and its origin is always at the uppermost, leftmost cell.
Safety
You must be careful not to end up with multiple exclusive references to the standard plane, or with one exclusive reference and one or more shared references.
C style function: notcurses_stdplane().
Returns a reference to the standard NcPlane
for this terminal.
The standard plane always exists, and its origin is always at the uppermost, leftmost cell.
Safety
You must be careful not to end up with a mix of exclusive references and shared references to the standard plane.
C style function: notcurses_stdplane_const().
Gets the name of an NcBlitter
blitter.
C style function: notcurses_str_blitter().
Gets the name of an NcScale
scaling mode.
C style function: notcurses_str_scalemode().
Gets the lowercase name (or names) of the styles included in an NcStyle
.
(No equivalent C style function)
Returns an NcStyle
with the supported curses-style attributes.
The attribute is only indicated as supported if the terminal can support it together with color.
For more information, see the “ncv” capability in terminfo(5).
C style function: notcurses_supported_styles().
Returns our current idea of the terminal dimensions in rows and cols.
C style function: notcurses_term_dim_yx().
Returns the bottommost NcPlane
on the standard pile,
of which there is always at least one.
C style function: notcurses_bottom().
Returns the topmost NcPlane
, of which there is always at least one.
C style function: notcurses_top().
Returns a human-readable string describing the running notcurses version.
C style function: notcurses_version().
Returns the running notcurses version components (major, minor, patch, tweak).
C style function: notcurses_version_components().
pub fn visual_geom(
&self,
visual: Option<&NcVisual>,
vopts: Option<&NcVisualOptions>
) -> NcResult<NcVisualGeometry>
pub fn visual_geom(
&self,
visual: Option<&NcVisual>,
vopts: Option<&NcVisualOptions>
) -> NcResult<NcVisualGeometry>
Returns NcVisualGeometry
.
If an NcVisual
is not provided, only the cdim_yx
, blitter
,
scale_yx
, and maxpixel_yx
fields will be filled in.
If an NcVisualOptions
is not provided, a default one will be used.
Additionally cdim_yx
and maxpixel_yx
are only ever filled in if we
know them, and maxpixel_yx
is only defined for NcBlitter::Pixel
.
See also
C style function: ncvisual_geom().
Like visual_geom
but auto-fills the NcVisualOptions
with
NcBlitter::Pixel
in order to get the maximum available resolution
for scale_yx
, which determines the minimum dot-size for an NcVisual
.