nxt namespace
Terminal grid geometry.
This is intentionally much smaller than a general units library. It models the dimensions nxt actually needs: columns, rows, ratios, percentages, and terminal positions.
Namespaces
Classes
- struct Cell
- Cell data for inspection.
- struct ChangeRun
- class GlyphTable
- struct IndexedCell
- A cell with its column position for iteration.
- struct Pos
- Two-dimensional zero-based terminal position.
- class Raster
- class RasterView
- struct RawChange
- struct Rgb8
- Opaque 24-bit RGB color.
- struct Rgba8
- struct Size
- Two-dimensional extent in terminal cells.
- struct StyleState
- struct ansi_origin_t
- One-based ANSI-column origin tag.
- struct ansi_origin_v_t
- One-based ANSI-row origin tag.
- struct cancelled
- Exception thrown when an operation is cancelled.
- struct ch_unit
- Literal unit for terminal-cell widths.
- struct col_t
- Strong type for a zero-based terminal column.
- struct disconnected
- Exception thrown when trying to push to a channel with no receiver.
- struct empty_context
- struct height_t
- Strong type for vertical extents measured in terminal lines.
- struct ln_unit
- Literal unit for terminal-line heights.
- struct one_unit
- Literal unit for dimensionless ratios.
- struct percent_t
- Percentage value, where 100 means one whole.
- struct percent_unit
- Literal unit for percentages.
-
template <typename T, typename Pull>class pull_source
- struct ratio_t
- Dimensionless flex or scale ratio.
- struct row_t
- Strong type for a zero-based terminal row.
-
template <typename Context = empty_class scope
context> -
template <typename T>struct source_value
-
template <typename T>struct source_value<channel<T>>
-
template <typename T, typename Pull>struct source_value<pull_source<T, Pull>>
-
template <typename T>struct source_value<signal<T>>
- struct terminal_origin_t
- Zero-based terminal-column origin tag.
- struct terminal_origin_v_t
- Zero-based terminal-row origin tag.
- struct width_t
- Strong type for horizontal extents measured in terminal cells.
Concepts
-
template <typename Sink, typename T>concept sink
-
template <typename Source>concept source
-
template <typename T>concept numeric
- Arithmetic type accepted by the unit literal operators.
-
template <typename S>concept has_context
-
template <typename S>concept scoped
Enums
Typedefs
-
using ansi_col_t = col_
t - ANSI columns share the same representation but are interpreted one-based.
-
using ansi_row_t = row_
t - ANSI rows share the same representation but are interpreted one-based.
-
template <typename T>using bound_publisher = detail::
bound_publisher<T> -
template <typename T>using channel = nxt::
detail:: event_queue<T> - Buffered async stream of values.
-
using color_view_t = std::
experimental:: mdspan<Rgba8, mdspan_ extents, std:: experimental:: layout_stride> - Mutable 2D color view.
-
using const_color_view_t = std::
experimental:: mdspan<const Rgba8, mdspan_ extents, std:: experimental:: layout_stride> - Const 2D color view.
-
using const_emphasis_view_t = std::
experimental:: mdspan<const Emphasis, mdspan_ extents, std:: experimental:: layout_stride> - Const 2D emphasis view.
-
using const_glyph_view_t = std::
experimental:: mdspan<const GlyphTable:: GlyphId, mdspan_ extents, std:: experimental:: layout_stride> - Const 2D glyph view.
-
using emphasis_view_t = std::
experimental:: mdspan<Emphasis, mdspan_ extents, std:: experimental:: layout_stride> - Mutable 2D emphasis view.
- using event = coro::event
- Manually signaled coroutine event.
-
template <typename T>using generator = coro::generator<T>
- Coroutine generator type.
-
using glyph_view_t = std::
experimental:: mdspan<GlyphTable:: GlyphId, mdspan_ extents, std:: experimental:: layout_stride> - Mutable 2D glyph view.
- using io_scheduler = scheduler
- using latch = coro::latch
- Coroutine latch primitive.
-
using mdspan_extents = std::
experimental:: extents<std:: size_t, std:: dynamic_extent, std:: dynamic_extent> - Dynamic extents for terminal-cell rasters.
- using poll_op = coro::poll_op
- Poll operation type from libcoro.
- using poll_status = coro::poll_status
- Poll status type from libcoro.
- using poll_stop_source = coro::poll_stop_source
- Stop source for cancellable poll operations.
-
template <typename T>using publisher = detail::
publisher<T> -
template <typename T>using queue = coro::queue<T>
- Async multi-producer/multi-consumer queue.
- using scheduler = coro::scheduler
- Scheduler type used by nxt async operations.
-
template <std::using semaphore = coro::semaphore<max_value>
ptrdiff_t max_value> - Counting semaphore with a compile-time maximum value.
-
template <typename T>using signal = detail::
signal<T> -
template <typename T>using source_value_t = typename source_
value<std:: remove_cvref_t<T>>::type -
template <typename T = void>using task = coro::task<T>
- Coroutine task type used throughout nxt.
Functions
-
template <scoped Scope, typename... Awaitables>auto all(Scope& s, Awaitables && ... awaitables) → auto
-
template <scoped Scope, typename... Awaitables>auto any(Scope& s, Awaitables && ... awaitables) → auto
-
template <typename T, typename Extents, typename Layout, typename Accessor>auto as_range(std::
experimental:: mdspan<T, Extents, Layout, Accessor> m) → auto -
template <scoped Scope>void cancel(Scope& s)
-
template <typename T>auto cancel(channel<T>& ch) → task<void>
-
template <typename T>auto close(channel<T>& ch) → task<void>
-
template <typename T>void close(signal<T>& sig)
-
template <typename F>void diff_rasters(const Raster& front, const Raster& back, F&& emit)
- auto has_emphasis(Emphasis set, Emphasis flag) → bool constexpr noexcept
-
auto indexed_cell_row(const_
glyph_ view_ t glyphs, const_ color_ view_ t fgs, const_ color_ view_ t bgs, const_ emphasis_ view_ t ems, std:: size_t row_idx) → auto - Get a row as indexed cells (col, glyph, fg, bg, em).
-
template <typename T, typename Extents, typename Layout, typename Accessor>auto indexed_row(std::
experimental:: mdspan<T, Extents, Layout, Accessor> m, std:: size_t row_idx) → auto -
template <typename T, typename Pull>auto make_source(Pull&& pull) → auto
-
template <typename T>auto next(const signal<T>& sig) → auto
-
template <typename T>auto next(const signal<T>& sig, std::
stop_token stop) → auto -
template <typename T>auto next(channel<T>& ch, std::
stop_token = {}) → task<std:: optional<T>> -
template <typename T, typename Pull>auto next(pull_
source<T, Pull>& src, std:: stop_token stop = {}) → task<std:: optional<T>> - auto operator&(Emphasis a, Emphasis b) → Emphasis constexpr noexcept
-
template <numeric T>auto operator*(T n, ch_
unit) → width_ t constexpr noexcept - Create a width from a number of terminal cells.
-
template <numeric T>auto operator*(T n, ln_
unit) → height_ t constexpr noexcept - Create a height from a number of terminal lines.
-
template <numeric T>auto operator*(T n, one_
unit) → ratio_ t constexpr noexcept - Create a dimensionless ratio.
-
template <numeric T>auto operator*(T n, percent_
unit) → percent_ t constexpr noexcept - Create a percentage value.
-
auto operator*(width_
t a, double b) → width_ t constexpr noexcept - Scale a width by a floating-point factor.
-
auto operator*(double a,
width_
t b) → width_ t constexpr noexcept - Scale a width by a floating-point factor.
-
auto operator*(height_
t a, double b) → height_ t constexpr noexcept - Scale a height by a floating-point factor.
-
auto operator*(double a,
height_
t b) → height_ t constexpr noexcept - Scale a height by a floating-point factor.
-
auto operator*(percent_
t a, double b) → percent_ t constexpr noexcept - Scale a percentage by a scalar.
-
auto operator*(double a,
percent_
t b) → percent_ t constexpr noexcept - Scale a percentage by a scalar.
-
auto operator+(width_
t a, width_ t b) → width_ t constexpr noexcept - Add widths.
-
auto operator+(height_
t a, height_ t b) → height_ t constexpr noexcept - Add heights.
-
auto operator+(ratio_
t a, ratio_ t b) → ratio_ t constexpr noexcept - Add ratios.
-
auto operator+(percent_
t a, percent_ t b) → percent_ t constexpr noexcept - Add percentages.
-
auto operator+(terminal_
origin_ t, width_ t dx) → col_ t constexpr noexcept - Offset the terminal column origin by a width.
-
auto operator+(terminal_
origin_ v_ t, height_ t dy) → row_ t constexpr noexcept - Offset the terminal row origin by a height.
-
auto operator+(col_
t p, width_ t dx) → col_ t constexpr noexcept - Move a column to the right.
-
auto operator+(row_
t p, height_ t dy) → row_ t constexpr noexcept - Move a row down.
-
auto operator-(width_
t a, width_ t b) → width_ t constexpr noexcept - Subtract widths.
-
auto operator-(height_
t a, height_ t b) → height_ t constexpr noexcept - Subtract heights.
-
auto operator-(ratio_
t a, ratio_ t b) → ratio_ t constexpr noexcept - Subtract ratios.
-
auto operator-(percent_
t a, percent_ t b) → percent_ t constexpr noexcept - Subtract percentages.
-
auto operator-(col_
t p, width_ t dx) → col_ t constexpr noexcept - Move a column to the left.
-
auto operator-(col_
t a, col_ t b) → width_ t constexpr noexcept - Distance between two columns.
-
auto operator-(col_
t p, terminal_ origin_ t) → width_ t constexpr noexcept - Convert a column back to a zero-based width from terminal origin.
-
auto operator-(col_
t p, ansi_ origin_ t) → width_ t constexpr noexcept - Convert a zero-based column to a one-based ANSI column value.
-
auto operator-(row_
t p, height_ t dy) → row_ t constexpr noexcept - Move a row up.
-
auto operator-(row_
t a, row_ t b) → height_ t constexpr noexcept - Distance between two rows.
-
auto operator-(row_
t p, terminal_ origin_ v_ t) → height_ t constexpr noexcept - Convert a row back to a zero-based height from terminal origin.
-
auto operator-(row_
t p, ansi_ origin_ v_ t) → height_ t constexpr noexcept - Convert a zero-based row to a one-based ANSI row value.
-
auto operator/(percent_
t a, double b) → percent_ t constexpr noexcept - Divide a percentage by a scalar.
-
template <numeric T>auto operator<(ratio_
t a, T b) → bool constexpr noexcept - Compare a ratio against a numeric value.
-
auto operator<(percent_
t a, ratio_ t b) → bool constexpr noexcept - Compare a percentage with a ratio after converting to a ratio.
-
template <numeric T>auto operator<=(ratio_
t a, T b) → bool constexpr noexcept - Compare a ratio against a numeric value.
-
auto operator<=(percent_
t a, ratio_ t b) → bool constexpr noexcept - Compare a percentage with a ratio after converting to a ratio.
-
template <numeric T>auto operator>(ratio_
t a, T b) → bool constexpr noexcept - Compare a ratio against a numeric value.
-
auto operator>(percent_
t a, ratio_ t b) → bool constexpr noexcept - Compare a percentage with a ratio after converting to a ratio.
-
template <numeric T>auto operator>=(ratio_
t a, T b) → bool constexpr noexcept - Compare a ratio against a numeric value.
-
auto operator>=(percent_
t a, ratio_ t b) → bool constexpr noexcept - Compare a percentage with a ratio after converting to a ratio.
- auto operator|(Emphasis a, Emphasis b) → Emphasis constexpr noexcept
- auto operator|=(Emphasis& a, Emphasis b) → Emphasis& constexpr noexcept
-
template <typename T>auto publish(const publisher<T>& pub, T value) → task<void>
-
template <typename T>auto publish(const bound_
publisher<T>& pub) → task<void> -
template <typename T>auto publish(channel<T>& ch, T value) → task<bool>
-
template <typename T>auto publisher_for(const signal<T>& sig) → auto
-
template <typename T>auto publisher_for(const signal<T>& sig, T value) → auto
- auto raw_changes(const Raster& front, const Raster& back) → auto
-
auto row_changes(height_
t y, auto cells, const Raster& back) → auto -
template <typename T, typename Extents, typename Layout, typename Accessor>auto row_range(std::
experimental:: mdspan<T, Extents, Layout, Accessor> m, std:: size_t row_idx) → auto - Get a single row from a 2D mdspan as a range.
-
template <scoped Scope>auto scheduler_of(Scope& s) → auto&
-
template <scoped Scope, typename... Sources>auto select(Scope& scope, Sources&... sources) → task<std::
variant<std:: optional<source_ value_ t<Sources>>...>> -
template <scoped Scope>void spawn(Scope& s, task<> t)
- auto start(scheduler& sched, task<> t) → auto
-
template <scoped Scope>auto stop_token(Scope& s) → auto
-
template <scoped Scope>auto subscope(Scope& s) → auto
-
template <scoped Scope, typename Context>auto subscope(Scope& s, Context context) → auto
- auto sync_wait(auto&& awaitable) → auto
- Run an awaitable synchronously on the current thread.
-
auto to_ansi(col_
t col) → ansi_ col_ t constexpr noexcept - Convert a terminal column to the representation used by ANSI writer calls.
-
auto to_ansi(row_
t row) → ansi_ row_ t constexpr noexcept - Convert a terminal row to the representation used by ANSI writer calls.
-
auto to_ansi_x(Pos pos) → ansi_
col_ t constexpr noexcept - Convert a position's column for ANSI writer calls.
-
auto to_ansi_y(Pos pos) → ansi_
row_ t constexpr noexcept - Convert a position's row for ANSI writer calls.
- auto when_all(auto&& tasks) → auto
- Await a collection of tasks.
- auto when_all(auto&& first, auto&& second, auto && ... rest) → auto
- Await several awaitables.
- auto zip_rows(const Raster& front, const Raster& back) → auto
Variables
- Rgba8 DEFAULT_COLOR constexpr
- Emphasis DEFAULT_EMPHASIS constexpr
- Default emphasis (none)
-
ansi_
origin_ t ansi_origin constexpr - One-based ANSI-column origin.
-
ansi_
origin_ v_ t ansi_origin_v constexpr - One-based ANSI-row origin.
-
ch_
unit ch constexpr - Character-cell width unit.
- auto is_changed constexpr
- Did this cell change? (comparing old vs new from a zipped pair)
-
ln_
unit ln constexpr - Terminal line-height unit.
-
one_
unit one constexpr - Dimensionless ratio unit.
-
percent_
unit percent constexpr - Percent unit. A value of
100 * percentis equivalent to1 * one. - auto same_run constexpr
-
terminal_
origin_ t terminal_origin constexpr - Zero-based terminal-column origin.
-
terminal_
origin_ v_ t terminal_origin_v constexpr - Zero-based terminal-row origin.
Enum documentation
enum class nxt:: Emphasis: std:: uint8_t
#include <nxt/raster.hpp>
Bitfield for text emphasis attributes. These map directly to SGR codes: bold=1, faint=2, italic=3, etc.
Typedef documentation
using nxt:: ansi_col_t = col_ t
#include <nxt/units.hpp>
ANSI columns share the same representation but are interpreted one-based.
using nxt:: ansi_row_t = row_ t
#include <nxt/units.hpp>
ANSI rows share the same representation but are interpreted one-based.
#include <nxt/signal.hpp>
template <typename T>
using nxt:: bound_publisher = detail:: bound_publisher<T>
#include <nxtio/async.hpp>
template <typename T>
using nxt:: channel = nxt:: detail:: event_queue<T>
Buffered async stream of values.
using nxt:: color_view_t = std:: experimental:: mdspan<Rgba8, mdspan_ extents, std:: experimental:: layout_stride>
#include <nxt/raster.hpp>
Mutable 2D color view.
using nxt:: const_color_view_t = std:: experimental:: mdspan<const Rgba8, mdspan_ extents, std:: experimental:: layout_stride>
#include <nxt/raster.hpp>
Const 2D color view.
using nxt:: const_emphasis_view_t = std:: experimental:: mdspan<const Emphasis, mdspan_ extents, std:: experimental:: layout_stride>
#include <nxt/raster.hpp>
Const 2D emphasis view.
using nxt:: const_glyph_view_t = std:: experimental:: mdspan<const GlyphTable:: GlyphId, mdspan_ extents, std:: experimental:: layout_stride>
#include <nxt/raster.hpp>
Const 2D glyph view.
using nxt:: emphasis_view_t = std:: experimental:: mdspan<Emphasis, mdspan_ extents, std:: experimental:: layout_stride>
#include <nxt/raster.hpp>
Mutable 2D emphasis view.
using nxt:: event = coro::event
#include <nxtio/async-core.hpp>
Manually signaled coroutine event.
#include <nxtio/async-core.hpp>
template <typename T>
using nxt:: generator = coro::generator<T>
Coroutine generator type.
using nxt:: glyph_view_t = std:: experimental:: mdspan<GlyphTable:: GlyphId, mdspan_ extents, std:: experimental:: layout_stride>
#include <nxt/raster.hpp>
Mutable 2D glyph view.
using nxt:: io_scheduler = scheduler
#include <nxtio/async-core.hpp>
using nxt:: latch = coro::latch
#include <nxtio/async-core.hpp>
Coroutine latch primitive.
using nxt:: mdspan_extents = std:: experimental:: extents<std:: size_t, std:: dynamic_extent, std:: dynamic_extent>
#include <nxt/raster.hpp>
Dynamic extents for terminal-cell rasters.
using nxt:: poll_op = coro::poll_op
#include <nxtio/async-core.hpp>
Poll operation type from libcoro.
using nxt:: poll_status = coro::poll_status
#include <nxtio/async-core.hpp>
Poll status type from libcoro.
using nxt:: poll_stop_source = coro::poll_stop_source
#include <nxtio/async-core.hpp>
Stop source for cancellable poll operations.
#include <nxt/signal.hpp>
template <typename T>
using nxt:: publisher = detail:: publisher<T>
#include <nxtio/async-core.hpp>
template <typename T>
using nxt:: queue = coro::queue<T>
Async multi-producer/multi-consumer queue.
using nxt:: scheduler = coro::scheduler
#include <nxtio/async-core.hpp>
Scheduler type used by nxt async operations.
#include <nxtio/async-core.hpp>
template <std:: ptrdiff_t max_value>
using nxt:: semaphore = coro::semaphore<max_value>
Counting semaphore with a compile-time maximum value.
#include <nxt/signal.hpp>
template <typename T>
using nxt:: signal = detail:: signal<T>
#include <nxtio/async.hpp>
template <typename T>
using nxt:: source_value_t = typename source_ value<std:: remove_cvref_t<T>>::type
#include <nxtio/async-core.hpp>
template <typename T = void>
using nxt:: task = coro::task<T>
Coroutine task type used throughout nxt.
Function documentation
#include <nxtio/async.hpp>
template <scoped Scope, typename... Awaitables>
auto nxt:: all(Scope& s,
Awaitables && ... awaitables)
#include <nxtio/async.hpp>
template <scoped Scope, typename... Awaitables>
auto nxt:: any(Scope& s,
Awaitables && ... awaitables)
#include <nxt/raster.hpp>
template <typename T, typename Extents, typename Layout, typename Accessor>
auto nxt:: as_range(std:: experimental:: mdspan<T, Extents, Layout, Accessor> m)
Convert a 2D mdspan to a flat range (row-major order). Works with any layout (contiguous or strided from submdspan).
#include <nxtio/async.hpp>
template <scoped Scope>
void nxt:: cancel(Scope& s)
#include <nxtio/async.hpp>
template <typename T>
task<void> nxt:: cancel(channel<T>& ch)
#include <nxtio/async.hpp>
template <typename T>
task<void> nxt:: close(channel<T>& ch)
#include <nxtio/async.hpp>
template <typename T>
void nxt:: close(signal<T>& sig)
#include <nxt/raster-diff.hpp>
template <typename F>
void nxt:: diff_rasters(const Raster& front,
const Raster& back,
F&& emit)
Iterate changed regions, tracking style state for minimal ANSI output.
bool nxt:: has_emphasis(Emphasis set,
Emphasis flag) constexpr noexcept
#include <nxt/raster.hpp>
auto nxt:: indexed_cell_row(const_ glyph_ view_ t glyphs,
const_ color_ view_ t fgs,
const_ color_ view_ t bgs,
const_ emphasis_ view_ t ems,
std:: size_t row_idx)
#include <nxt/raster.hpp>
Get a row as indexed cells (col, glyph, fg, bg, em).
#include <nxt/raster.hpp>
template <typename T, typename Extents, typename Layout, typename Accessor>
auto nxt:: indexed_row(std:: experimental:: mdspan<T, Extents, Layout, Accessor> m,
std:: size_t row_idx)
Get an indexed row range (pairs of column index and value reference).
#include <nxtio/async.hpp>
template <typename T, typename Pull>
auto nxt:: make_source(Pull&& pull)
#include <nxtio/async.hpp>
template <typename T>
auto nxt:: next(const signal<T>& sig)
#include <nxtio/async.hpp>
template <typename T>
auto nxt:: next(const signal<T>& sig,
std:: stop_token stop)
#include <nxtio/async.hpp>
template <typename T>
task<std:: optional<T>> nxt:: next(channel<T>& ch,
std:: stop_token = {})
#include <nxtio/async.hpp>
template <typename T, typename Pull>
task<std:: optional<T>> nxt:: next(pull_ source<T, Pull>& src,
std:: stop_token stop = {})
Emphasis nxt:: operator&(Emphasis a,
Emphasis b) constexpr noexcept
#include <nxt/raster.hpp>
#include <nxt/units.hpp>
template <numeric T>
width_ t nxt:: operator*(T n,
ch_ unit) constexpr noexcept
Create a width from a number of terminal cells.
#include <nxt/units.hpp>
template <numeric T>
height_ t nxt:: operator*(T n,
ln_ unit) constexpr noexcept
Create a height from a number of terminal lines.
#include <nxt/units.hpp>
template <numeric T>
ratio_ t nxt:: operator*(T n,
one_ unit) constexpr noexcept
Create a dimensionless ratio.
#include <nxt/units.hpp>
template <numeric T>
percent_ t nxt:: operator*(T n,
percent_ unit) constexpr noexcept
Create a percentage value.
width_ t nxt:: operator*(width_ t a,
double b) constexpr noexcept
#include <nxt/units.hpp>
Scale a width by a floating-point factor.
width_ t nxt:: operator*(double a,
width_ t b) constexpr noexcept
#include <nxt/units.hpp>
Scale a width by a floating-point factor.
height_ t nxt:: operator*(height_ t a,
double b) constexpr noexcept
#include <nxt/units.hpp>
Scale a height by a floating-point factor.
height_ t nxt:: operator*(double a,
height_ t b) constexpr noexcept
#include <nxt/units.hpp>
Scale a height by a floating-point factor.
percent_ t nxt:: operator*(percent_ t a,
double b) constexpr noexcept
#include <nxt/units.hpp>
Scale a percentage by a scalar.
percent_ t nxt:: operator*(double a,
percent_ t b) constexpr noexcept
#include <nxt/units.hpp>
Scale a percentage by a scalar.
width_ t nxt:: operator+(width_ t a,
width_ t b) constexpr noexcept
#include <nxt/units.hpp>
Add widths.
height_ t nxt:: operator+(height_ t a,
height_ t b) constexpr noexcept
#include <nxt/units.hpp>
Add heights.
ratio_ t nxt:: operator+(ratio_ t a,
ratio_ t b) constexpr noexcept
#include <nxt/units.hpp>
Add ratios.
percent_ t nxt:: operator+(percent_ t a,
percent_ t b) constexpr noexcept
#include <nxt/units.hpp>
Add percentages.
col_ t nxt:: operator+(terminal_ origin_ t,
width_ t dx) constexpr noexcept
#include <nxt/units.hpp>
Offset the terminal column origin by a width.
row_ t nxt:: operator+(terminal_ origin_ v_ t,
height_ t dy) constexpr noexcept
#include <nxt/units.hpp>
Offset the terminal row origin by a height.
col_ t nxt:: operator+(col_ t p,
width_ t dx) constexpr noexcept
#include <nxt/units.hpp>
Move a column to the right.
row_ t nxt:: operator+(row_ t p,
height_ t dy) constexpr noexcept
#include <nxt/units.hpp>
Move a row down.
width_ t nxt:: operator-(width_ t a,
width_ t b) constexpr noexcept
#include <nxt/units.hpp>
Subtract widths.
height_ t nxt:: operator-(height_ t a,
height_ t b) constexpr noexcept
#include <nxt/units.hpp>
Subtract heights.
ratio_ t nxt:: operator-(ratio_ t a,
ratio_ t b) constexpr noexcept
#include <nxt/units.hpp>
Subtract ratios.
percent_ t nxt:: operator-(percent_ t a,
percent_ t b) constexpr noexcept
#include <nxt/units.hpp>
Subtract percentages.
col_ t nxt:: operator-(col_ t p,
width_ t dx) constexpr noexcept
#include <nxt/units.hpp>
Move a column to the left.
width_ t nxt:: operator-(col_ t a,
col_ t b) constexpr noexcept
#include <nxt/units.hpp>
Distance between two columns.
width_ t nxt:: operator-(col_ t p,
terminal_ origin_ t) constexpr noexcept
#include <nxt/units.hpp>
Convert a column back to a zero-based width from terminal origin.
width_ t nxt:: operator-(col_ t p,
ansi_ origin_ t) constexpr noexcept
#include <nxt/units.hpp>
Convert a zero-based column to a one-based ANSI column value.
row_ t nxt:: operator-(row_ t p,
height_ t dy) constexpr noexcept
#include <nxt/units.hpp>
Move a row up.
height_ t nxt:: operator-(row_ t a,
row_ t b) constexpr noexcept
#include <nxt/units.hpp>
Distance between two rows.
height_ t nxt:: operator-(row_ t p,
terminal_ origin_ v_ t) constexpr noexcept
#include <nxt/units.hpp>
Convert a row back to a zero-based height from terminal origin.
height_ t nxt:: operator-(row_ t p,
ansi_ origin_ v_ t) constexpr noexcept
#include <nxt/units.hpp>
Convert a zero-based row to a one-based ANSI row value.
percent_ t nxt:: operator/(percent_ t a,
double b) constexpr noexcept
#include <nxt/units.hpp>
Divide a percentage by a scalar.
#include <nxt/units.hpp>
template <numeric T>
bool nxt:: operator<(ratio_ t a,
T b) constexpr noexcept
Compare a ratio against a numeric value.
bool nxt:: operator<(percent_ t a,
ratio_ t b) constexpr noexcept
#include <nxt/units.hpp>
Compare a percentage with a ratio after converting to a ratio.
#include <nxt/units.hpp>
template <numeric T>
bool nxt:: operator<=(ratio_ t a,
T b) constexpr noexcept
Compare a ratio against a numeric value.
bool nxt:: operator<=(percent_ t a,
ratio_ t b) constexpr noexcept
#include <nxt/units.hpp>
Compare a percentage with a ratio after converting to a ratio.
#include <nxt/units.hpp>
template <numeric T>
bool nxt:: operator>(ratio_ t a,
T b) constexpr noexcept
Compare a ratio against a numeric value.
bool nxt:: operator>(percent_ t a,
ratio_ t b) constexpr noexcept
#include <nxt/units.hpp>
Compare a percentage with a ratio after converting to a ratio.
#include <nxt/units.hpp>
template <numeric T>
bool nxt:: operator>=(ratio_ t a,
T b) constexpr noexcept
Compare a ratio against a numeric value.
bool nxt:: operator>=(percent_ t a,
ratio_ t b) constexpr noexcept
#include <nxt/units.hpp>
Compare a percentage with a ratio after converting to a ratio.
Emphasis nxt:: operator|(Emphasis a,
Emphasis b) constexpr noexcept
#include <nxt/raster.hpp>
Emphasis& nxt:: operator|=(Emphasis& a,
Emphasis b) constexpr noexcept
#include <nxt/raster.hpp>
#include <nxtio/async.hpp>
template <typename T>
task<void> nxt:: publish(const publisher<T>& pub,
T value)
#include <nxtio/async.hpp>
template <typename T>
task<void> nxt:: publish(const bound_ publisher<T>& pub)
#include <nxtio/async.hpp>
template <typename T>
task<bool> nxt:: publish(channel<T>& ch,
T value)
#include <nxtio/async.hpp>
template <typename T>
auto nxt:: publisher_for(const signal<T>& sig)
#include <nxtio/async.hpp>
template <typename T>
auto nxt:: publisher_for(const signal<T>& sig,
T value)
auto nxt:: raw_changes(const Raster& front,
const Raster& back)
#include <nxt/raster-diff.hpp>
Iterate changed regions between two rasters as a lazy range.
Pipeline: zip_rows(front, back) – pair up rows from both rasters | transform(row_changes) – extract changed runs from each row | join – flatten into single stream
auto nxt:: row_changes(height_ t y,
auto cells,
const Raster& back)
#include <nxt/raster-diff.hpp>
Extract changed runs from a single row. Groups cells by run boundaries, keeps only changed runs, converts to RawChange.
#include <nxt/raster.hpp>
template <typename T, typename Extents, typename Layout, typename Accessor>
auto nxt:: row_range(std:: experimental:: mdspan<T, Extents, Layout, Accessor> m,
std:: size_t row_idx)
Get a single row from a 2D mdspan as a range.
#include <nxtio/async.hpp>
template <scoped Scope>
auto& nxt:: scheduler_of(Scope& s)
#include <nxtio/async.hpp>
template <scoped Scope, typename... Sources>
task<std:: variant<std:: optional<source_ value_ t<Sources>>...>> nxt:: select(Scope& scope,
Sources&... sources)
#include <nxtio/async.hpp>
template <scoped Scope>
void nxt:: spawn(Scope& s,
task<> t)
auto nxt:: start(scheduler& sched,
task<> t)
#include <nxtio/async-core.hpp>
Schedule a task to run on the given scheduler. Use this instead of co_await scheduler.schedule() at the top of coroutines.
#include <nxtio/async.hpp>
template <scoped Scope>
auto nxt:: stop_token(Scope& s)
#include <nxtio/async.hpp>
template <scoped Scope>
auto nxt:: subscope(Scope& s)
#include <nxtio/async.hpp>
template <scoped Scope, typename Context>
auto nxt:: subscope(Scope& s,
Context context)
auto nxt:: sync_wait(auto&& awaitable)
#include <nxtio/async-core.hpp>
Run an awaitable synchronously on the current thread.
ansi_ col_ t nxt:: to_ansi(col_ t col) constexpr noexcept
#include <nxt/units.hpp>
Convert a terminal column to the representation used by ANSI writer calls.
ansi_ row_ t nxt:: to_ansi(row_ t row) constexpr noexcept
#include <nxt/units.hpp>
Convert a terminal row to the representation used by ANSI writer calls.
ansi_ col_ t nxt:: to_ansi_x(Pos pos) constexpr noexcept
#include <nxt/units.hpp>
Convert a position's column for ANSI writer calls.
ansi_ row_ t nxt:: to_ansi_y(Pos pos) constexpr noexcept
#include <nxt/units.hpp>
Convert a position's row for ANSI writer calls.
auto nxt:: when_all(auto&& tasks)
#include <nxtio/async-core.hpp>
Await a collection of tasks.
auto nxt:: when_all(auto&& first,
auto&& second,
auto && ... rest)
#include <nxtio/async-core.hpp>
Await several awaitables.
auto nxt:: zip_rows(const Raster& front,
const Raster& back)
#include <nxt/raster.hpp>
Zip two rasters' rows together for comparison. Yields (height_
Variable documentation
Rgba8 nxt:: DEFAULT_COLOR constexpr
#include <nxt/raster.hpp>
Default color for terminal cells (resets to terminal's configured color)
Emphasis nxt:: DEFAULT_EMPHASIS constexpr
#include <nxt/raster.hpp>
Default emphasis (none)
ansi_ origin_ t nxt:: ansi_origin constexpr
#include <nxt/units.hpp>
One-based ANSI-column origin.
ansi_ origin_ v_ t nxt:: ansi_origin_v constexpr
#include <nxt/units.hpp>
One-based ANSI-row origin.
ch_ unit nxt:: ch constexpr
#include <nxt/units.hpp>
Character-cell width unit.
auto nxt:: is_changed constexpr
#include <nxt/raster-diff.hpp>
Did this cell change? (comparing old vs new from a zipped pair)
ln_ unit nxt:: ln constexpr
#include <nxt/units.hpp>
Terminal line-height unit.
one_ unit nxt:: one constexpr
#include <nxt/units.hpp>
Dimensionless ratio unit.
percent_ unit nxt:: percent constexpr
#include <nxt/units.hpp>
Percent unit. A value of 100 * percent is equivalent to 1 * one.
auto nxt:: same_run constexpr
#include <nxt/raster-diff.hpp>
Should two cell pairs belong in the same run? Yes if: both changed (or both unchanged) AND same style in new buffer.
terminal_ origin_ t nxt:: terminal_origin constexpr
#include <nxt/units.hpp>
Zero-based terminal-column origin.
terminal_ origin_ v_ t nxt:: terminal_origin_v constexpr
#include <nxt/units.hpp>
Zero-based terminal-row origin.