Skip to main content

TerminalManager

Struct TerminalManager 

Source
pub struct TerminalManager { /* private fields */ }
Expand description

Terminal manager that wraps the PTY session

Implementations§

Source§

impl TerminalManager

Source

pub fn get_clipboard_history(&self, slot: ClipboardSlot) -> Vec<ClipboardEntry>

Get clipboard history for a specific slot

Source

pub fn get_latest_clipboard( &self, slot: ClipboardSlot, ) -> Option<ClipboardEntry>

Get the most recent clipboard entry for a slot

Source

pub fn search_clipboard_history( &self, query: &str, slot: Option<ClipboardSlot>, ) -> Vec<ClipboardEntry>

Search clipboard history across all slots or a specific slot

Source

pub fn add_to_clipboard_history( &self, slot: ClipboardSlot, content: String, label: Option<String>, )

Add content to clipboard history

Source

pub fn clear_clipboard_history(&self, slot: ClipboardSlot)

Clear clipboard history for a specific slot

Source

pub fn clear_all_clipboard_history(&self)

Clear all clipboard history

Source

pub fn set_max_clipboard_sync_events(&self, max: usize)

Set maximum clipboard sync events retained

Source

pub fn set_max_clipboard_event_bytes(&self, max_bytes: usize)

Set maximum bytes cached per clipboard event

Source

pub fn set_max_clipboard_sync_history(&self, max: usize)

Set maximum clipboard history entries per slot

Source§

impl TerminalManager

Source

pub fn get_graphics(&self) -> Vec<TerminalGraphic>

Get all graphics (Sixel, iTerm2, Kitty) Returns a vector of cloned TerminalGraphic objects for rendering

Source

pub fn get_graphics_at_row(&self, row: usize) -> Vec<TerminalGraphic>

Get graphics at a specific row

Source

pub fn graphics_count(&self) -> usize

Get total graphics count

Source

pub fn get_scrollback_graphics(&self) -> Vec<TerminalGraphic>

Get all scrollback graphics

Source

pub fn update_animations(&self) -> bool

Update animations and return true if any frames changed

Source

pub fn get_graphics_with_animations(&self) -> Vec<TerminalGraphic>

Get all graphics with current animation frames

Source§

impl TerminalManager

Get all OSC 8 hyperlinks from the terminal

Get the URL for a specific hyperlink ID

Source§

impl TerminalManager

Source

pub fn get_cells_with_scrollback( &self, scroll_offset: usize, selection: Option<((usize, usize), (usize, usize))>, rectangular: bool, _cursor: Option<((usize, usize), f32)>, ) -> Vec<Cell>

Get terminal grid with scrollback offset as Cell array for CellRenderer

Source§

impl TerminalManager

Source

pub fn spawn_shell(&mut self) -> Result<(), Error>

Spawn a shell in the terminal

Source

pub fn spawn_custom_shell(&mut self, command: &str) -> Result<(), Error>

Spawn a custom shell command in the terminal

Source

pub fn spawn_custom_shell_with_args( &mut self, command: &str, args: &[String], ) -> Result<(), Error>

Spawn a custom shell with arguments

Source

pub fn spawn_shell_with_dir( &mut self, working_dir: Option<&str>, env_vars: Option<&HashMap<String, String>>, ) -> Result<(), Error>

Spawn shell with optional working directory and environment variables

Source

pub fn spawn_custom_shell_with_dir( &mut self, command: &str, args: Option<&[String]>, working_dir: Option<&str>, env_vars: Option<&HashMap<String, String>>, ) -> Result<(), Error>

Spawn custom shell with args, optional working directory, and environment variables

Source§

impl TerminalManager

Source

pub fn new(cols: usize, rows: usize) -> Result<TerminalManager, Error>

Create a new terminal manager with the specified dimensions

Source

pub fn new_with_scrollback( cols: usize, rows: usize, scrollback_size: usize, ) -> Result<TerminalManager, Error>

Create a new terminal manager with specified dimensions and scrollback size

Source

pub fn set_theme(&mut self, theme: Theme)

Set the color theme

Source

pub fn update_scrollback_metadata( &mut self, scrollback_len: usize, cursor_row: usize, )

Update scrollback metadata based on shell integration events from the core.

Drains the queued ShellIntegrationEvent events from the terminal, each of which carries the cursor_line at the exact moment the OSC 133 marker was parsed. This eliminates the batching problem where multiple markers arrive between frames and only the last one was visible via marker().

Command text is captured from the terminal grid when the marker changes away from CommandStart, then injected into scrollback marks after apply_event() creates them.

Source

pub fn scrollback_marks(&self) -> Vec<ScrollbackMark>

Get rendered scrollback marks (prompt/command boundaries).

Source

pub fn scrollback_previous_mark(&self, line: usize) -> Option<usize>

Find previous prompt mark before the given absolute line (if any).

Source

pub fn scrollback_next_mark(&self, line: usize) -> Option<usize>

Find next prompt mark after the given absolute line (if any).

Source

pub fn core_command_history(&self) -> Vec<(String, Option<i32>, Option<u64>)>

Get command history from the core library (commands tracked via shell integration).

Returns commands as (command_text, exit_code, duration_ms) tuples.

Source

pub fn set_cell_dimensions(&self, width: u32, height: u32)

Set cell dimensions in pixels for sixel graphics scroll calculations

Source

pub fn write(&self, data: &[u8]) -> Result<(), Error>

Write data to the PTY (send user input to shell)

Source

pub fn write_str(&self, data: &str) -> Result<(), Error>

Write string to the PTY

Source

pub fn process_data(&self, data: &[u8])

Process raw data through the terminal emulator (for tmux output routing).

Source

pub fn paste(&self, content: &str) -> Result<(), Error>

Paste text to the terminal with proper bracketed paste handling.

Source

pub async fn paste_with_delay( &self, content: &str, delay_ms: u64, ) -> Result<(), Error>

Paste text with a delay between lines.

Source

pub fn content(&self) -> Result<String, Error>

Get the terminal content as a string

Source

pub fn resize(&mut self, cols: usize, rows: usize) -> Result<(), Error>

Resize the terminal

Source

pub fn resize_with_pixels( &mut self, cols: usize, rows: usize, width_px: usize, height_px: usize, ) -> Result<(), Error>

Resize the terminal with pixel dimensions

Source

pub fn set_pixel_size( &mut self, width_px: usize, height_px: usize, ) -> Result<(), Error>

Set pixel dimensions for XTWINOPS CSI 14 t query support

Source

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

Get the current terminal dimensions

Source

pub fn terminal(&self) -> Arc<Mutex<RawMutex, Terminal>>

Get a clone of the underlying terminal for direct access

Source

pub fn has_updates(&self) -> bool

Check if there have been updates since last check

Source

pub fn is_running(&self) -> bool

Check if the PTY is still running

Source

pub fn kill(&mut self) -> Result<(), Error>

Kill the PTY process

Source

pub fn bell_count(&self) -> u64

Get the current bell event count

Source

pub fn scrollback(&self) -> Vec<String>

Get scrollback lines

Source

pub fn scrollback_len(&self) -> usize

Get scrollback length

Source

pub fn line_text_at_absolute(&self, absolute_line: usize) -> Option<String>

Get text of a line at an absolute index (scrollback + screen).

Source

pub fn lines_text_range(&self, start: usize, end: usize) -> Vec<(String, usize)>

Get all lines in a range as text (for search in copy mode).

Source

pub fn scrollback_as_cells(&self) -> Vec<Vec<Cell>>

Get all scrollback lines as Cell arrays.

Source

pub fn clear_scrollback(&self)

Clear scrollback buffer

Source

pub fn clear_scrollback_metadata(&mut self)

Clear scrollback metadata (prompt marks, command history, timestamps).

Source

pub fn search(&self, query: &str, case_sensitive: bool) -> Vec<SearchMatch>

Search for text in the visible screen.

Source

pub fn search_scrollback( &self, query: &str, case_sensitive: bool, max_lines: Option<usize>, ) -> Vec<SearchMatch>

Search for text in the scrollback buffer.

Source

pub fn search_all(&self, query: &str, case_sensitive: bool) -> Vec<SearchMatch>

Search for text in both visible screen and scrollback.

Source

pub fn take_notifications(&self) -> Vec<Notification>

Take all pending OSC 9/777 notifications

Source

pub fn has_notifications(&self) -> bool

Check if there are pending OSC 9/777 notifications

Source

pub fn screenshot_to_file( &self, path: &Path, format: &str, scrollback_lines: usize, ) -> Result<(), Error>

Take a screenshot of the terminal and save to file

Source

pub fn record_marker(&self, label: String)

Add a marker to the recording

Source

pub fn export_recording_to_file( &self, session: &RecordingSession, path: &Path, format: &str, ) -> Result<(), Error>

Export recording to file (asciicast or JSON format)

Source

pub fn shell_integration_cwd(&self) -> Option<String>

Get current working directory from shell integration (OSC 7)

Source

pub fn shell_integration_exit_code(&self) -> Option<i32>

Get last command exit code from shell integration (OSC 133)

Source

pub fn shell_integration_command(&self) -> Option<String>

Get current command from shell integration

Source

pub fn shell_integration_hostname(&self) -> Option<String>

Get hostname from shell integration (OSC 7)

Source

pub fn shell_integration_username(&self) -> Option<String>

Get username from shell integration (OSC 7)

Source

pub fn poll_cwd_events(&self) -> Vec<CwdChange>

Poll CWD change events from terminal

Source

pub fn poll_action_results(&self) -> Vec<ActionResult>

Poll trigger action results from the core terminal.

Source

pub fn get_active_transfers(&self) -> Vec<FileTransfer>

Source

pub fn get_completed_transfers(&self) -> Vec<FileTransfer>

Source

pub fn take_completed_transfer(&self, id: u64) -> Option<FileTransfer>

Source

pub fn cancel_file_transfer(&self, id: u64) -> bool

Source

pub fn send_upload_data(&self, data: &[u8])

Source

pub fn cancel_upload(&self)

Source

pub fn poll_upload_requests(&self) -> Vec<String>

Source

pub fn custom_session_variables(&self) -> HashMap<String, String>

Source

pub fn shell_integration_stats(&self) -> ShellIntegrationStats

Source

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

Get cursor position

Source

pub fn cursor_style(&self) -> CursorStyle

Get cursor style from terminal for rendering

Source

pub fn set_cursor_style(&mut self, style: CursorStyle)

Set cursor style for the terminal

Source

pub fn is_cursor_visible(&self) -> bool

Check if cursor is visible

Source

pub fn is_mouse_tracking_enabled(&self) -> bool

Check if mouse tracking is enabled

Source

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

Send focus event to PTY if the application has enabled focus tracking (DECSET 1004). Returns true if the event was sent.

Source

pub fn is_alt_screen_active(&self) -> bool

Check if alternate screen is active

Source

pub fn modify_other_keys_mode(&self) -> u8

Get the modifyOtherKeys mode

Source

pub fn application_cursor(&self) -> bool

Check if application cursor key mode (DECCKM) is enabled.

Source

pub fn get_title(&self) -> String

Get the terminal title set by OSC 0, 1, or 2 sequences

Source

pub fn shell_integration_marker(&self) -> Option<ShellIntegrationMarker>

Get the current shell integration marker state

Source

pub fn is_command_running(&self) -> bool

Check if a command is currently running based on shell integration

Source

pub fn get_running_command_name(&self) -> Option<String>

Get the name of the currently running command (first word only)

Source

pub fn should_confirm_close(&self, jobs_to_ignore: &[String]) -> Option<String>

Check if tab close should show a confirmation dialog

Source

pub fn should_report_mouse_motion(&self, button_pressed: bool) -> bool

Check if mouse motion events should be reported

Source

pub fn encode_mouse_event( &self, button: u8, col: usize, row: usize, pressed: bool, modifiers: u8, ) -> Vec<u8>

Send a mouse event to the terminal and get the encoded bytes

Source

pub fn get_styled_segments(&self) -> Vec<StyledSegment>

Get styled segments from the terminal for rendering

Source

pub fn update_generation(&self) -> u64

Get the current generation number for dirty tracking

Source§

impl TerminalManager

Source

pub fn progress_bar(&self) -> ProgressBar

Get the simple progress bar state (OSC 9;4)

Source

pub fn named_progress_bars(&self) -> HashMap<String, NamedProgressBar>

Get all named progress bars (OSC 934)

Source

pub fn has_any_progress(&self) -> bool

Check if any progress bar is currently active

Source§

impl TerminalManager

Source

pub fn set_answerback_string(&self, answerback: Option<String>)

Source

pub fn set_width_config(&self, config: WidthConfig)

Source

pub fn set_normalization_form(&self, form: NormalizationForm)

Source

pub fn set_output_callback<F>(&self, callback: F)
where F: Fn(&[u8]) + Send + Sync + 'static,

Source

pub fn start_recording(&self, title: Option<String>)

Source

pub fn stop_recording(&self) -> Option<RecordingSession>

Source

pub fn is_recording(&self) -> bool

Source

pub fn export_asciicast(&self, session: &RecordingSession) -> String

Source§

impl TerminalManager

Source§

impl TerminalManager

Source§

impl TerminalManager

Source

pub fn sync_triggers(&self, triggers: &[TriggerConfig])

Sync trigger configs from Config into the core TriggerRegistry.

Source§

impl TerminalManager

Source

pub fn add_observer(&self, observer: Arc<dyn TerminalObserver>) -> u64

Source

pub fn remove_observer(&self, id: u64) -> bool

Trait Implementations§

Source§

impl Drop for TerminalManager

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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 + Sync + Send>

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<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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