pub struct TermTui {
pub title: String,
pub focused: bool,
pub copy_mode: CopyMode,
pub border_style: Style,
pub focused_border_style: Style,
pub keybindings: TermTuiKeyBindings,
/* private fields */
}Expand description
TermTui - Terminal widget with mprocs-style architecture
Features:
- termwiz-based VT100 parsing
- VecDeque scrollback buffer
- Copy mode with frozen screen snapshots
- Mouse and keyboard selection
Fields§
§title: StringTitle for the terminal
focused: boolWhether the terminal has focus
copy_mode: CopyModeCopy mode state
border_style: StyleStyling
focused_border_style: Style§keybindings: TermTuiKeyBindingsCustomizable keybindings
Implementations§
Source§impl TermTui
impl TermTui
Sourcepub fn with_keybindings(self, keybindings: TermTuiKeyBindings) -> Self
pub fn with_keybindings(self, keybindings: TermTuiKeyBindings) -> Self
Set custom keybindings (builder pattern)
Sourcepub fn spawn_with_command(
title: impl Into<String>,
command: &str,
args: &[&str],
) -> Result<Self>
pub fn spawn_with_command( title: impl Into<String>, command: &str, args: &[&str], ) -> Result<Self>
Spawn a terminal with a command
Sourcepub fn handle_key(&mut self, key: KeyEvent) -> bool
pub fn handle_key(&mut self, key: KeyEvent) -> bool
Handle keyboard input
Sourcepub fn enter_copy_mode(&mut self)
pub fn enter_copy_mode(&mut self)
Enter copy mode with frozen screen
Sourcepub fn handle_mouse(&mut self, event: MouseEvent, area: Rect) -> bool
pub fn handle_mouse(&mut self, event: MouseEvent, area: Rect) -> bool
Handle mouse events
This method handles all mouse interactions:
- Mouse drag: automatically enters copy mode and starts selection (like mprocs)
- Mouse wheel: scrolls the terminal content
- In copy mode: mouse click moves cursor, mouse drag selects
§Arguments
event- The mouse event from crosstermarea- The area where the terminal is rendered (for coordinate translation)
§Returns
true if the event was handled, false otherwise
Sourcepub fn handle_mouse_down(&mut self, x: u16, y: u16)
👎Deprecated since 0.2.0: Use handle_mouse instead for comprehensive mouse handling
pub fn handle_mouse_down(&mut self, x: u16, y: u16)
Handle mouse down (start selection)
Note: Consider using handle_mouse instead for comprehensive mouse handling.
Sourcepub fn handle_mouse_drag(&mut self, x: u16, y: u16)
👎Deprecated since 0.2.0: Use handle_mouse instead for comprehensive mouse handling
pub fn handle_mouse_drag(&mut self, x: u16, y: u16)
Handle mouse drag (update selection)
Note: Consider using handle_mouse instead for comprehensive mouse handling.
Sourcepub fn handle_mouse_up(&mut self)
👎Deprecated since 0.2.0: Use handle_mouse instead for comprehensive mouse handling
pub fn handle_mouse_up(&mut self)
Handle mouse up
Note: Consider using handle_mouse instead for comprehensive mouse handling.
Sourcepub fn scroll_down(&mut self, lines: usize)
pub fn scroll_down(&mut self, lines: usize)
Scroll down
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear selection
Sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Check if has selection
Sourcepub fn get_selected_text(&self) -> Option<String>
pub fn get_selected_text(&self) -> Option<String>
Get selected text
Sourcepub fn send_input(&self, text: &str)
pub fn send_input(&self, text: &str)
Send input to the terminal
Sourcepub fn render_content(&mut self, frame: &mut Frame<'_>, area: Rect)
pub fn render_content(&mut self, frame: &mut Frame<'_>, area: Rect)
Render terminal content (without borders)
Auto Trait Implementations§
impl Freeze for TermTui
impl !RefUnwindSafe for TermTui
impl Send for TermTui
impl Sync for TermTui
impl Unpin for TermTui
impl !UnwindSafe for TermTui
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> 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 more