Buffer Rendering
ReadableBuffer::toString() serializes a buffer’s logical cells into a String.
It is inherited by Buffer, CursorBuffer, and readable buffer views.
Formats and Options
BufferRenderOptions is a fluent value type.
setFormat(RenderFormat::Text) selects plain text; RenderFormat::Ansi selects ANSI SGR presentation.
ANSI is the default, and the enum permits additional representations in future versions.
setTrimTrailingSpaces(true) removes default-style spaces at row ends.
setTrimTrailingEmptyLines(true) removes default-style empty rows at the bottom.
Both options default to false, preserving the buffer’s dimensions.
Visually meaningful styled blanks are retained, including when trimming is enabled.
Output Contract
Rows are separated by LF; no final newline is appended. Wide-character continuation cells are not emitted a second time. ANSI output resolves inherited presentation against terminal defaults, preserves supported colors and attributes, and resets presentation at its boundaries. Plain output contains no terminal control sequences. Rendering does not modify the source buffer or cursor.
For compact documentation output, enable both trimming options and append a final newline only if the surrounding file format requires one.
Interface
-
class BufferRenderOptions
Fluent options controlling buffer serialization.
See: Buffer Rendering
Public Functions
-
inline RenderFormat format() const noexcept
Get the selected output representation.
-
inline BufferRenderOptions &setFormat(RenderFormat format) noexcept
Select the output representation.
-
inline bool trimTrailingSpaces() const noexcept
Test whether default-style spaces at the end of a row are omitted.
-
inline BufferRenderOptions &setTrimTrailingSpaces(bool enabled) noexcept
Select removal of default-style spaces at the end of rows.
-
inline bool trimTrailingEmptyLines() const noexcept
Test whether default-style empty bottom rows are omitted.
-
inline BufferRenderOptions &setTrimTrailingEmptyLines(bool enabled) noexcept
Select removal of default-style empty bottom rows.
-
inline RenderFormat format() const noexcept