Struct term_model::term::Term

source ·
pub struct Term<T> {
    pub is_focused: bool,
    pub dirty: bool,
    pub visual_bell: VisualBell,
    /* private fields */
}

Fields§

§is_focused: bool

Terminal focus

§dirty: bool§visual_bell: VisualBell

Implementations§

source§

impl<T> Term<T>

source

pub fn selection(&self) -> &Option<Selection>

source

pub fn selection_mut(&mut self) -> &mut Option<Selection>

source

pub fn scroll_display(&mut self, scroll: Scroll)
where T: EventListener,

source

pub fn new<C>( config: &Config<C>, size: &SizeInfo, clipboard: Clipboard, event_proxy: T ) -> Term<T>

source

pub fn update_config<C>(&mut self, config: &Config<C>)

source

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

Convert the active selection to a String.

source

pub fn bounds_to_string(&self, start: Point<usize>, end: Point<usize>) -> String

Convert range between two points to a String.

source

pub fn visible_to_buffer(&self, point: Point) -> Point<usize>

source

pub fn buffer_to_visible( &self, point: impl Into<Point<usize>> ) -> Option<Point<usize>>

source

pub fn grid(&self) -> &Grid<Cell>

Access to the raw grid data structure

This is a bit of a hack; when the window is closed, the event processor serializes the grid state to a file.

source

pub fn renderable_cells<'b, C>( &'b self, config: &'b Config<C> ) -> RenderableCellsIter<'_, C>

Iterate over the renderable cells in the terminal

A renderable cell is any cell which has content other than the default background color. Cells with an alternate background color are considered renderable as are cells with any text content.

source

pub fn resize(&mut self, size: &SizeInfo)

Resize terminal to new dimensions

source

pub fn mode(&self) -> &TermMode

source

pub fn cursor(&self) -> &Cursor

source

pub fn swap_alt(&mut self)

source

pub fn background_color(&self) -> Rgb

source

pub fn exit(&mut self)
where T: EventListener,

source

pub fn clipboard(&mut self) -> &mut Clipboard

Trait Implementations§

source§

impl<T: EventListener> Handler for Term<T>

source§

fn input(&mut self, c: char)

A character to be displayed

source§

fn backspace(&mut self)

Backspace count characters

source§

fn carriage_return(&mut self)

Carriage return

source§

fn linefeed(&mut self)

Linefeed

source§

fn bell(&mut self)

Set current position as a tabstop

source§

fn newline(&mut self)

Run LF/NL

LF/NL mode has some interesting history. According to ECMA-48 4th edition, in LINE FEED mode,

The execution of the formatter functions LINE FEED (LF), FORM FEED (FF), LINE TABULATION (VT) cause only movement of the active position in the direction of the line progression.

In NEW LINE mode,

The execution of the formatter functions LINE FEED (LF), FORM FEED (FF), LINE TABULATION (VT) cause movement to the line home position on the following line, the following form, etc. In the case of LF this is referred to as the New Line (NL) option.

Additionally, ECMA-48 4th edition says that this option is deprecated. ECMA-48 5th edition only mentions this option (without explanation) saying that it’s been removed.

As an emulator, we need to support it since applications may still rely on it.

source§

fn set_color(&mut self, index: usize, color: Rgb)

Set the indexed color value

source§

fn dynamic_color_sequence<W: Write>( &mut self, writer: &mut W, code: u8, index: usize )

Write a foreground/background color escape sequence with the current color

source§

fn reset_color(&mut self, index: usize)

Reset the indexed color to original value

source§

fn set_clipboard(&mut self, clipboard: u8, base64: &[u8])

Set the clipboard

source§

fn write_clipboard<W: Write>(&mut self, clipboard: u8, writer: &mut W)

Write clipboard data to child.

source§

fn terminal_attribute(&mut self, attr: Attr)

set a terminal attribute

source§

fn set_title(&mut self, title: &str)

OSC to set window title
source§

fn decaln(&mut self)

Run the decaln routine.
source§

fn goto(&mut self, line: Line, col: Column)

Set cursor to position
source§

fn goto_line(&mut self, line: Line)

Set cursor to specific row
source§

fn goto_col(&mut self, col: Column)

Set cursor to specific column
source§

fn insert_blank(&mut self, count: Column)

Insert blank characters in current line starting from cursor
source§

fn move_up(&mut self, lines: Line)

Move cursor up rows
source§

fn move_down(&mut self, lines: Line)

Move cursor down rows
source§

fn move_forward(&mut self, cols: Column)

Move cursor forward cols
source§

fn move_backward(&mut self, cols: Column)

Move cursor backward cols
source§

fn identify_terminal<W: Write>(&mut self, writer: &mut W)

Identify the terminal (should write back to the pty stream) Read more
source§

fn device_status<W: Write>(&mut self, writer: &mut W, arg: usize)

source§

fn move_down_and_cr(&mut self, lines: Line)

Move cursor down rows and set to column 1
source§

fn move_up_and_cr(&mut self, lines: Line)

Move cursor up rows and set to column 1
source§

fn put_tab(&mut self, count: i64)

Put count tabs
source§

fn substitute(&mut self)

Substitute char under cursor
source§

fn set_horizontal_tabstop(&mut self)

Set current position as a tabstop
source§

fn scroll_up(&mut self, lines: Line)

Scroll up rows rows
source§

fn scroll_down(&mut self, lines: Line)

Scroll down rows rows
source§

fn insert_blank_lines(&mut self, lines: Line)

Insert count blank lines
source§

fn delete_lines(&mut self, lines: Line)

Delete count lines
source§

fn erase_chars(&mut self, count: Column)

Erase count chars in current line following cursor Read more
source§

fn delete_chars(&mut self, count: Column)

Delete count chars Read more
source§

fn move_backward_tabs(&mut self, count: i64)

Move backward count tabs
source§

fn move_forward_tabs(&mut self, count: i64)

Move forward count tabs
source§

fn save_cursor_position(&mut self)

Save current cursor position
source§

fn restore_cursor_position(&mut self)

Restore cursor position
source§

fn clear_line(&mut self, mode: LineClearMode)

Clear current line
source§

fn clear_screen(&mut self, mode: ClearMode)

Clear screen
source§

fn clear_tabs(&mut self, mode: TabulationClearMode)

Clear tab stops
source§

fn reset_state(&mut self)

Reset terminal state
source§

fn reverse_index(&mut self)

Reverse Index Read more
source§

fn set_mode(&mut self, mode: Mode)

Set mode
source§

fn unset_mode(&mut self, mode: Mode)

Unset mode
source§

fn set_scrolling_region(&mut self, top: usize, bottom: usize)

DECSTBM - Set the terminal scrolling region
source§

fn set_keypad_application_mode(&mut self)

DECKPAM - Set keypad to applications mode (ESCape instead of digits)
source§

fn unset_keypad_application_mode(&mut self)

DECKPNM - Set keypad to numeric mode (digits instead of ESCape seq)
source§

fn configure_charset(&mut self, index: CharsetIndex, charset: StandardCharset)

Assign a graphic character set to G0, G1, G2 or G3 Read more
source§

fn set_active_charset(&mut self, index: CharsetIndex)

Set one of the graphic character sets, G0 to G3, as the active charset. Read more
source§

fn set_cursor_style(&mut self, style: Option<CursorStyle>)

Set the cursor style
source§

fn push_title(&mut self)

Push a title onto the stack
source§

fn pop_title(&mut self)

Pop the last title from the stack
source§

impl<T> Search for Term<T>

source§

fn semantic_search_left(&self, point: Point<usize>) -> Point<usize>

Find the nearest semantic boundary to the left of provided point.
source§

fn semantic_search_right(&self, point: Point<usize>) -> Point<usize>

Find the nearest semantic boundary to the point of provided point.
source§

fn line_search_left(&self, point: Point<usize>) -> Point<usize>

Find the beginning of a line, following line wraps.
source§

fn line_search_right(&self, point: Point<usize>) -> Point<usize>

Find the end of a line, following line wraps.
Find the nearest matching bracket.
source§

impl<T> TermInfo for Term<T>

source§

fn lines(&self) -> Line

source§

fn cols(&self) -> Column

Auto Trait Implementations§

§

impl<T> Freeze for Term<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Term<T>
where T: RefUnwindSafe,

§

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

§

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

§

impl<T> Unpin for Term<T>
where T: Unpin,

§

impl<T> UnwindSafe for Term<T>
where T: UnwindSafe,

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

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.