ansi namespace
Classes
- struct SynchronizedUpdate
- RAII wrapper for terminal synchronized update mode.
- struct TerminalGuard
- class Writer
- ANSI escape sequence builder that writes to a string buffer.
Enums
- enum class Mode { disabled, debug, enabled }
- ANSI output modes.
- enum class TerminalColor: int { black = 30, red = 31, green = 32, yellow = 33, blue = 34, magenta = 35, cyan = 36, white = 37, bright_black = 90, bright_red = 91, bright_green = 92, bright_yellow = 93, bright_blue = 94, bright_magenta = 95, bright_cyan = 96, bright_white = 97 }
- ANSI 16-color SGR foreground codes.
Functions
- void begin_synchronized_update()
- void clear_line()
- void clear_screen()
- void end_synchronized_update()
- void hide_cursor()
- void init()
- auto is_tty() → bool
- Check if stdout is connected to a real TTY.
-
void move_to(ansi_
row_ t row, ansi_ col_ t col) - void move_to(Pos pos)
-
auto query_cursor_position() → std::
optional<Pos> -
auto render_raster(const Raster& raster) → std::
string - void reset_scroll_region()
-
void scroll_down(height_
t n = 1*ln) -
void scroll_up(height_
t n = 1*ln) -
void set_scroll_region(row_
t top, row_ t bottom) - void show_cursor()
Variables
Enum documentation
enum class nxt:: ansi:: Mode
#include <nxt/ansi.hpp>
ANSI output modes.
enum class nxt:: ansi:: TerminalColor: int
#include <nxt/ansi.hpp>
ANSI 16-color SGR foreground codes.
Function documentation
void nxt:: ansi:: begin_synchronized_update()
#include <nxt/ansi.hpp>
void nxt:: ansi:: clear_line()
#include <nxt/ansi.hpp>
void nxt:: ansi:: clear_screen()
#include <nxt/ansi.hpp>
void nxt:: ansi:: end_synchronized_update()
#include <nxt/ansi.hpp>
void nxt:: ansi:: hide_cursor()
#include <nxt/ansi.hpp>
void nxt:: ansi:: init()
#include <nxt/ansi.hpp>
Initialize the ANSI module. Sets mode based on TTY detection. Call this early in main().
bool nxt:: ansi:: is_tty()
#include <nxt/ansi.hpp>
Check if stdout is connected to a real TTY.
void nxt:: ansi:: move_to(ansi_ row_ t row,
ansi_ col_ t col)
#include <nxt/ansi.hpp>
void nxt:: ansi:: move_to(Pos pos)
#include <nxt/ansi.hpp>
std:: optional<Pos> nxt:: ansi:: query_cursor_position()
#include <nxt/ansi.hpp>
Query current cursor position (blocking). Sends DSR 6 and reads CPR response from stdin. Returns nullopt if query fails (not a TTY, timeout, parse error). Requires terminal to be in raw mode for reliable response reading.
std:: string nxt:: ansi:: render_raster(const Raster& raster)
#include <nxt/ansi.hpp>
Standalone functions for immediate output (writes directly to stdout) Render a raster as inline SGR-styled text suitable for scrollback output.
void nxt:: ansi:: reset_scroll_region()
#include <nxt/ansi.hpp>
void nxt:: ansi:: scroll_down(height_ t n = 1*ln)
#include <nxt/ansi.hpp>
void nxt:: ansi:: scroll_up(height_ t n = 1*ln)
#include <nxt/ansi.hpp>
void nxt:: ansi:: set_scroll_region(row_ t top,
row_ t bottom)
#include <nxt/ansi.hpp>
void nxt:: ansi:: show_cursor()
#include <nxt/ansi.hpp>
Variable documentation
Mode nxt:: ansi:: mode
#include <nxt/ansi.hpp>
Current ANSI output mode.