pub struct TerminalBuilder { /* private fields */ }
Expand description
Builder for configuring and creating a Terminal
.
Provides a fluent API for terminal configuration with sensible defaults. The terminal will use the default embedded font atlas unless explicitly configured.
§Examples
// Simple terminal with default configuration
use beamterm_renderer::{FontAtlas, FontAtlasData, Terminal};
let terminal = Terminal::builder("#canvas").build()?;
// Terminal with custom font atlas
let atlas = FontAtlasData::from_binary(unimplemented!(".atlas data"))?;
let terminal = Terminal::builder("#canvas")
.font_atlas(atlas)
.fallback_glyph("X".into())
.build()?;
Implementations§
Source§impl TerminalBuilder
impl TerminalBuilder
Sourcepub fn font_atlas(self, atlas: FontAtlasData) -> Self
pub fn font_atlas(self, atlas: FontAtlasData) -> Self
Sets a custom font atlas for the terminal.
By default, the terminal uses an embedded font atlas. Use this method to provide a custom atlas with different fonts, sizes, or character sets.
Sourcepub fn fallback_glyph(self, glyph: &str) -> Self
pub fn fallback_glyph(self, glyph: &str) -> Self
Sets the fallback glyph for missing characters.
When a character is not found in the font atlas, this glyph will be displayed instead. Defaults to a space character if not specified.
Sourcepub fn canvas_padding_color(self, color: u32) -> Self
pub fn canvas_padding_color(self, color: u32) -> Self
Sets the background color for the canvas area outside the terminal grid.
When the canvas dimensions don’t align perfectly with the terminal cell grid, there may be unused pixels around the edges. This color fills those padding areas to maintain a consistent appearance.
Sourcepub fn mouse_input_handler<F>(self, callback: F) -> Self
pub fn mouse_input_handler<F>(self, callback: F) -> Self
Sets a callback for handling terminal mouse input events.
Sourcepub fn default_mouse_input_handler(
self,
selection_mode: SelectionMode,
trim_trailing_whitespace: bool,
) -> Self
pub fn default_mouse_input_handler( self, selection_mode: SelectionMode, trim_trailing_whitespace: bool, ) -> Self
Sets a default selection handler for mouse input events. Left
button selects text, Ctrl/Cmd + C
copies the selected text to
the clipboard.