Struct Term

Source
pub struct Term {
    pub dirty: bool,
    pub visual_bell: VisualBell,
    pub next_is_urgent: Option<bool>,
    /* private fields */
}

Fields§

§dirty: bool§visual_bell: VisualBell§next_is_urgent: Option<bool>

Implementations§

Source§

impl Term

Source

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

Source

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

Source

pub fn get_next_title(&mut self) -> Option<String>

Source

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

Source

pub fn get_next_mouse_cursor(&mut self) -> Option<MouseCursor>

Source

pub fn new(size: SizeInfo) -> Term

Source

pub fn needs_draw(&self) -> bool

Source

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

Source

pub fn pixels_to_coords(&self, x: usize, y: usize) -> Option<Point>

Convert the given pixel values to a grid coordinate

The mouse coordinates are expected to be relative to the top left. The line and column returned are also relative to the top left.

Returns None if the coordinates are outside the screen

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(&self) -> RenderableCellsIter<'_>

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 size_info(&self) -> &SizeInfo

Source

pub fn mode(&self) -> &TermMode

Source

pub fn cursor(&self) -> &Cursor

Source

pub fn swap_alt(&mut self)

Source

pub fn exit(&mut self)

Source

pub fn should_exit(&self) -> bool

Trait Implementations§

Source§

impl Dimensions for Term

Source§

fn dimensions(&self) -> Point

Get the size of the area
Source§

impl Handler for Term

Source§

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

Set the window title

Source§

fn set_mouse_cursor(&mut self, cursor: MouseCursor)

Set the mouse cursor

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 index::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 terminal_attribute(&mut self, attr: Attr)

set a terminal attribute

Source§

fn set_clipboard(&mut self, _string: &str)

Set the clipboard

Source§

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

Set the cursor style
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 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_forward(&mut self, cols: Column)

Move cursor forward cols
Source§

fn move_backward(&mut self, cols: Column)

Move cursor backward cols
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, region: Range<Line>)

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 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 configure_charset(&mut self, index: CharsetIndex, charset: StandardCharset)

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

fn dectest(&mut self)

Run the dectest routine
Source§

fn set_color(&mut self, _: usize, _: Rgb)

Set an indexed color value
Source§

fn reset_color(&mut self, _: usize)

Reset an indexed color to original value
Source§

impl Search for Term

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.
Find the nearest URL boundary in both directions.
Source§

impl TermInfo for Term

Source§

fn lines(&self) -> Line

Source§

fn cols(&self) -> Column

Auto Trait Implementations§

§

impl Freeze for Term

§

impl RefUnwindSafe for Term

§

impl Send for Term

§

impl Sync for Term

§

impl Unpin for Term

§

impl UnwindSafe for Term

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.