Skip to main content

CellRenderer

Struct CellRenderer 

Source
pub struct CellRenderer { /* private fields */ }

Implementations§

Source§

impl CellRenderer

Source

pub fn clear_glyph_cache(&mut self)

Source§

impl CellRenderer

Source

pub fn set_background_image( &mut self, path: Option<&str>, mode: BackgroundImageMode, opacity: f32, )

Source

pub fn update_background_image_opacity(&mut self, opacity: f32)

Source

pub fn update_background_image_opacity_only(&mut self, opacity: f32)

Source

pub fn get_background_as_channel_texture(&self) -> Option<ChannelTexture>

Create a ChannelTexture from the current background image for use in custom shaders.

Returns None if no background image is loaded. The returned ChannelTexture shares the same underlying texture data with the cell renderer’s background image - no copy is made.

Source

pub fn has_background_image(&self) -> bool

Check if a background image is currently loaded.

Source

pub fn is_solid_color_background(&self) -> bool

Check if a solid color background is currently set.

Source

pub fn solid_background_color(&self) -> [f32; 3]

Get the solid background color as normalized RGB values. Returns the color even if not in solid color mode.

Source

pub fn get_solid_color_as_clear(&self) -> Option<Color>

Get the solid background color as a wgpu::Color with window_opacity applied. Returns None if not in solid color mode.

Source

pub fn create_solid_color_texture(&mut self, color: [u8; 3])

Create a solid color texture for use as background.

Creates a small (4x4) texture filled with the specified color. Uses Stretch mode for solid colors to fill the entire window. Transparency is controlled by window_opacity, not the texture alpha.

Source

pub fn get_solid_color_as_channel_texture( &self, color: [u8; 3], ) -> ChannelTexture

Create a ChannelTexture from a solid color for shader iChannel0.

Creates a small texture with the specified color that can be used as a channel texture in custom shaders. The texture is fully opaque; window_opacity controls overall transparency.

Source

pub fn set_background( &mut self, mode: BackgroundMode, color: [u8; 3], image_path: Option<&str>, image_mode: BackgroundImageMode, image_opacity: f32, image_enabled: bool, )

Set background based on mode (Default, Color, or Image).

This unified method handles all background types and should be used instead of calling individual methods directly.

Source§

impl CellRenderer

Source

pub fn render( &mut self, _show_scrollbar: bool, pane_background: Option<&PaneBackground>, ) -> Result<SurfaceTexture>

Source

pub fn render_to_texture( &mut self, target_view: &TextureView, skip_background_image: bool, ) -> Result<SurfaceTexture>

Render terminal content to an intermediate texture for shader processing.

§Arguments
  • target_view - The texture view to render to
  • skip_background_image - If true, skip rendering the background image. Use this when a custom shader will handle the background image via iChannel0 instead.

Note: Solid color backgrounds are NOT rendered here. For cursor shaders, the solid color is passed to the shader’s render function as the clear color instead.

Source

pub fn render_background_only( &self, target_view: &TextureView, clear_first: bool, ) -> Result<bool>

Render only the background (image or solid color) to a view.

This is useful for split pane rendering where the background should be rendered once full-screen before rendering each pane’s cells on top.

§Arguments
  • target_view - The texture view to render to
  • clear_first - If true, clear the surface before rendering
§Returns

true if a background image was rendered, false if only clear color was used

Source

pub fn render_to_view(&self, target_view: &TextureView) -> Result<()>

Render terminal content to a view for screenshots. This renders without requiring the surface texture.

Source

pub fn render_overlays( &mut self, surface_texture: &SurfaceTexture, show_scrollbar: bool, ) -> Result<()>

Source

pub fn render_pane_to_view( &mut self, surface_view: &TextureView, viewport: &PaneViewport, cells: &[Cell], cols: usize, rows: usize, cursor_pos: Option<(usize, usize)>, cursor_opacity: f32, show_scrollbar: bool, clear_first: bool, skip_background_image: bool, separator_marks: &[SeparatorMark], pane_background: Option<&PaneBackground>, ) -> Result<()>

Render a single pane’s content within a viewport to an existing surface texture

This method renders cells to a specific region of the render target, using a GPU scissor rect to clip to the pane bounds.

§Arguments
  • surface_view - The texture view to render to
  • viewport - The pane’s viewport (position, size, focus state, opacity)
  • cells - The cells to render (should match viewport grid size)
  • cols - Number of columns in the cell grid
  • rows - Number of rows in the cell grid
  • cursor_pos - Cursor position (col, row) within this pane, or None if no cursor
  • cursor_opacity - Cursor opacity (0.0 = hidden, 1.0 = fully visible)
  • show_scrollbar - Whether to render the scrollbar for this pane
  • clear_first - If true, clears the viewport region before rendering
  • skip_background_image - If true, skip rendering the background image. Use this when the background image has already been rendered full-screen (for split panes).
Source§

impl CellRenderer

Source

pub async fn new( window: Arc<Window>, font_family: Option<&str>, font_family_bold: Option<&str>, font_family_italic: Option<&str>, font_family_bold_italic: Option<&str>, font_ranges: &[FontRange], font_size: f32, cols: usize, rows: usize, window_padding: f32, line_spacing: f32, char_spacing: f32, scrollbar_position: &str, scrollbar_width: f32, scrollbar_thumb_color: [f32; 4], scrollbar_track_color: [f32; 4], enable_text_shaping: bool, enable_ligatures: bool, enable_kerning: bool, font_antialias: bool, font_hinting: bool, font_thin_strokes: ThinStrokesMode, minimum_contrast: f32, vsync_mode: VsyncMode, power_preference: PowerPreference, window_opacity: f32, background_color: [u8; 3], background_image_path: Option<&str>, background_image_mode: BackgroundImageMode, background_image_opacity: f32, ) -> Result<Self>

Source

pub fn device(&self) -> &Device

Source

pub fn queue(&self) -> &Queue

Source

pub fn surface_format(&self) -> TextureFormat

Source

pub fn cell_width(&self) -> f32

Source

pub fn cell_height(&self) -> f32

Source

pub fn window_padding(&self) -> f32

Source

pub fn content_offset_y(&self) -> f32

Source

pub fn set_content_offset_y(&mut self, offset: f32) -> Option<(usize, usize)>

Set the vertical content offset (e.g., tab bar height at top). Returns Some((cols, rows)) if grid size changed, None otherwise.

Source

pub fn content_offset_x(&self) -> f32

Source

pub fn set_content_offset_x(&mut self, offset: f32) -> Option<(usize, usize)>

Set the horizontal content offset (e.g., tab bar on left). Returns Some((cols, rows)) if grid size changed, None otherwise.

Source

pub fn content_inset_bottom(&self) -> f32

Source

pub fn set_content_inset_bottom(&mut self, inset: f32) -> Option<(usize, usize)>

Set the bottom content inset (e.g., tab bar at bottom). Returns Some((cols, rows)) if grid size changed, None otherwise.

Source

pub fn content_inset_right(&self) -> f32

Source

pub fn set_content_inset_right(&mut self, inset: f32) -> Option<(usize, usize)>

Set the right content inset (e.g., AI Inspector panel). Returns Some((cols, rows)) if grid size changed, None otherwise.

Source

pub fn grid_size(&self) -> (usize, usize)

Source

pub fn keep_text_opaque(&self) -> bool

Source

pub fn resize(&mut self, width: u32, height: u32) -> (usize, usize)

Source

pub fn update_cells(&mut self, new_cells: &[Cell]) -> bool

Update cells. Returns true if any row actually changed.

Source

pub fn clear_all_cells(&mut self)

Clear all cells and mark all rows as dirty.

Source

pub fn update_cursor( &mut self, pos: (usize, usize), opacity: f32, style: CursorStyle, ) -> bool

Update cursor position, opacity and style. Returns true if anything changed.

Source

pub fn clear_cursor(&mut self) -> bool

Source

pub fn update_cursor_color(&mut self, color: [u8; 3])

Update cursor color

Source

pub fn update_cursor_text_color(&mut self, color: Option<[u8; 3]>)

Update cursor text color (color of text under block cursor)

Source

pub fn set_cursor_hidden_for_shader(&mut self, hidden: bool) -> bool

Set whether cursor should be hidden when cursor shader is active. Returns true if the value changed.

Source

pub fn set_focused(&mut self, focused: bool) -> bool

Set window focus state (affects unfocused cursor rendering). Returns true if the value changed.

Source

pub fn update_cursor_guide(&mut self, enabled: bool, color: [u8; 4])

Update cursor guide settings

Source

pub fn update_cursor_shadow( &mut self, enabled: bool, color: [u8; 4], offset: [f32; 2], blur: f32, )

Update cursor shadow settings

Source

pub fn update_cursor_boost(&mut self, intensity: f32, color: [u8; 3])

Update cursor boost settings

Source

pub fn update_unfocused_cursor_style(&mut self, style: UnfocusedCursorStyle)

Update unfocused cursor style

Source

pub fn update_scrollbar( &mut self, scroll_offset: usize, visible_lines: usize, total_lines: usize, marks: &[ScrollbackMark], )

Source

pub fn update_scrollbar_for_pane( &mut self, scroll_offset: usize, visible_lines: usize, total_lines: usize, marks: &[ScrollbackMark], viewport: &PaneViewport, )

Update scrollbar state constrained to a specific pane’s bounds.

Converts the pane viewport (pixel bounds) into the inset parameters that Scrollbar::update expects, so the track and thumb are confined to the pane instead of spanning the full window.

Source

pub fn set_visual_bell_intensity(&mut self, intensity: f32)

Source

pub fn update_opacity(&mut self, opacity: f32)

Source

pub fn set_transparency_affects_only_default_background(&mut self, value: bool)

Set whether transparency affects only default background cells. When true, non-default (colored) backgrounds remain opaque for readability.

Source

pub fn set_keep_text_opaque(&mut self, value: bool)

Set whether text should always be rendered at full opacity. When true, text remains opaque regardless of window transparency settings.

Source

pub fn update_command_separator( &mut self, enabled: bool, thickness: f32, opacity: f32, exit_color: bool, color: [u8; 3], )

Update command separator settings from config

Source

pub fn set_separator_marks(&mut self, marks: Vec<SeparatorMark>) -> bool

Set the visible separator marks for the current frame. Returns true if the marks changed.

Source

pub fn set_gutter_indicators(&mut self, indicators: Vec<(usize, [f32; 4])>)

Set the gutter indicator data for the current frame.

Each entry is (screen_row, [r, g, b, a]) for the gutter background.

Source

pub fn update_scale_factor(&mut self, scale_factor: f64)

Update scale factor and recalculate all font metrics and cell dimensions. This is called when the window is dragged between displays with different DPIs.

Source

pub fn update_window_padding(&mut self, padding: f32) -> Option<(usize, usize)>

Source

pub fn update_scrollbar_appearance( &mut self, width: f32, thumb_color: [f32; 4], track_color: [f32; 4], )

Source

pub fn update_scrollbar_position(&mut self, position: &str)

Source

pub fn scrollbar_contains_point(&self, x: f32, y: f32) -> bool

Source

pub fn scrollbar_thumb_bounds(&self) -> Option<(f32, f32)>

Source

pub fn scrollbar_track_contains_x(&self, x: f32) -> bool

Source

pub fn scrollbar_mouse_y_to_scroll_offset(&self, mouse_y: f32) -> Option<usize>

Source

pub fn scrollbar_mark_at_position( &self, mouse_x: f32, mouse_y: f32, tolerance: f32, ) -> Option<&ScrollbackMark>

Find a scrollbar mark at the given mouse position for tooltip display. Returns the mark if mouse is within tolerance pixels of a mark.

Source

pub fn reconfigure_surface(&mut self)

Source

pub fn update_font_antialias(&mut self, enabled: bool) -> bool

Update font anti-aliasing setting Returns true if the setting changed (requiring glyph cache clear)

Source

pub fn update_font_hinting(&mut self, enabled: bool) -> bool

Update font hinting setting Returns true if the setting changed (requiring glyph cache clear)

Source

pub fn update_font_thin_strokes(&mut self, mode: ThinStrokesMode) -> bool

Update thin strokes mode Returns true if the setting changed (requiring glyph cache clear)

Source

pub fn update_minimum_contrast(&mut self, ratio: f32) -> bool

Update minimum contrast ratio Returns true if the setting changed (requiring redraw)

Source

pub fn supported_present_modes(&self) -> &[PresentMode]

Get the list of supported present modes for this surface

Source

pub fn is_vsync_mode_supported(&self, mode: VsyncMode) -> bool

Check if a vsync mode is supported

Source

pub fn update_vsync_mode(&mut self, mode: VsyncMode) -> (VsyncMode, bool)

Update the vsync mode. Returns the actual mode applied (may differ if requested mode unsupported). Also returns whether the mode was changed.

Source

pub fn current_vsync_mode(&self) -> VsyncMode

Get the current vsync mode

Source

pub fn update_graphics( &mut self, _graphics: &[TerminalGraphic], _scroll_offset: usize, _scrollback_len: usize, _visible_lines: usize, ) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,