pub struct TerminalConfig {
pub cols: usize,
pub rows: usize,
pub font_family: String,
pub font_size: Pixels,
pub scrollback: usize,
pub line_height_multiplier: f32,
pub padding: Edges<Pixels>,
pub colors: ColorPalette,
}Expand description
Configuration for terminal creation and runtime updates.
This struct defines the terminal’s appearance and behavior, including grid dimensions, font settings, scrollback buffer, and color scheme.
§Default Values
| Field | Default |
|---|---|
cols | 80 |
rows | 24 |
font_family | “monospace” |
font_size | 14px |
scrollback | 10000 |
line_height_multiplier | 1.2 |
padding | 0px all sides |
colors | Default palette |
§Example
use gpui::{Edges, px};
use gpui_terminal::{ColorPalette, TerminalConfig};
let config = TerminalConfig {
cols: 120,
rows: 40,
font_family: "JetBrains Mono".into(),
font_size: px(13.0),
scrollback: 50000,
line_height_multiplier: 1.1,
padding: Edges::all(px(10.0)),
colors: ColorPalette::builder()
.background(0x1a, 0x1a, 0x1a)
.foreground(0xe0, 0xe0, 0xe0)
.build(),
};§Runtime Updates
Configuration can be updated at runtime via TerminalView::update_config.
This is useful for implementing features like dynamic font sizing:
terminal.update(cx, |terminal, cx| {
let mut config = terminal.config().clone();
config.font_size += px(1.0);
terminal.update_config(config, cx);
});Fields§
§cols: usizeNumber of columns (character width) in the terminal
rows: usizeNumber of rows (lines) in the terminal
font_family: StringFont family name (e.g., “Fira Code”, “JetBrains Mono”)
font_size: PixelsFont size in pixels
scrollback: usizeMaximum number of scrollback lines to keep in history
line_height_multiplier: f32Multiplier for line height to accommodate tall glyphs (e.g., nerd fonts) Default is 1.2 (20% extra height)
padding: Edges<Pixels>Padding around the terminal content (top, right, bottom, left) The padding area renders with the terminal’s background color
colors: ColorPaletteColor palette for terminal colors (16 ANSI colors, 256 extended colors, foreground, background, and cursor colors)
Trait Implementations§
Source§impl Clone for TerminalConfig
impl Clone for TerminalConfig
Source§fn clone(&self) -> TerminalConfig
fn clone(&self) -> TerminalConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TerminalConfig
impl Debug for TerminalConfig
Auto Trait Implementations§
impl Freeze for TerminalConfig
impl RefUnwindSafe for TerminalConfig
impl Send for TerminalConfig
impl Sync for TerminalConfig
impl Unpin for TerminalConfig
impl UnwindSafe for TerminalConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().