term_model::term

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

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.