Struct alacritty_terminal::term::Term

source ·
pub struct Term<T> {
    pub is_focused: bool,
    pub vi_mode_cursor: ViModeCursor,
    pub selection: Option<Selection>,
    /* private fields */
}

Fields§

§is_focused: bool

Terminal focus controlling the cursor shape.

§vi_mode_cursor: ViModeCursor

Cursor for keyboard selection.

§selection: Option<Selection>

Implementations§

source§

impl<T> Term<T>

source

pub fn search_next( &self, regex: &mut RegexSearch, origin: Point, direction: Direction, side: Side, max_lines: Option<usize> ) -> Option<Match>

Get next search match in the specified direction.

source

pub fn regex_search_left( &self, regex: &mut RegexSearch, start: Point, end: Point ) -> Option<Match>

Find the next regex match to the left of the origin point.

The origin is always included in the regex.

source

pub fn regex_search_right( &self, regex: &mut RegexSearch, start: Point, end: Point ) -> Option<Match>

Find the next regex match to the right of the origin point.

The origin is always included in the regex.

Find next matching bracket.

source

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

Find left end of semantic block.

source

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

Find right end of semantic block.

source

pub fn inline_search_left( &self, point: Point, needles: &str ) -> Result<Point, Point>

Searching to the left, find the next character contained in needles.

source

pub fn inline_search_right( &self, point: Point, needles: &str ) -> Result<Point, Point>

Searching to the right, find the next character contained in needles.

source

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

Find the beginning of the current line across linewraps.

source

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

Find the end of the current line across linewraps.

source§

impl<T> Term<T>

source

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

source

pub fn new<D: Dimensions>( config: Config, dimensions: &D, event_proxy: T ) -> Term<T>

source

pub fn damage(&mut self) -> TermDamage<'_>

Collect the information about the changes in the lines, which could be used to minimize the amount of drawing operations.

The user controlled elements, like Vi mode cursor and Selection are not part of the collected damage state. Those could easily be tracked by comparing their old and new value between adjacent frames.

After reading damage reset_damage should be called.

source

pub fn reset_damage(&mut self)

Resets the terminal damage information.

source

pub fn set_options(&mut self, options: Config)
where T: EventListener,

Set new options for the Term.

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, end: Point) -> String

Convert range between two points to a String.

source

pub fn renderable_content(&self) -> RenderableContent<'_>
where T: EventListener,

Terminal content required for rendering.

source

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

Access to the raw grid data structure.

source

pub fn grid_mut(&mut self) -> &mut Grid<Cell>

Mutable access to the raw grid data structure.

source

pub fn resize<S: Dimensions>(&mut self, size: S)

Resize terminal to new dimensions.

source

pub fn mode(&self) -> &TermMode

Active terminal modes.

source

pub fn swap_alt(&mut self)

Swap primary and alternate screen buffer.

source

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

source

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

Toggle the vi mode.

source

pub fn vi_motion(&mut self, motion: ViMotion)
where T: EventListener,

Move vi mode cursor.

source

pub fn vi_goto_point(&mut self, point: Point)
where T: EventListener,

Move vi cursor to a point in the grid.

source

pub fn scroll_to_point(&mut self, point: Point)
where T: EventListener,

Scroll display to point if it is outside of viewport.

source

pub fn expand_wide(&self, point: Point, direction: Direction) -> Point

Jump to the end of a wide cell.

source

pub fn semantic_escape_chars(&self) -> &str

source

pub fn cursor_style(&self) -> CursorStyle

Active terminal cursor style.

While vi mode is active, this will automatically return the vi mode cursor style.

source

pub fn colors(&self) -> &Colors

Trait Implementations§

source§

impl<T> Dimensions for Term<T>

source§

fn columns(&self) -> usize

Width of the terminal in columns.
source§

fn screen_lines(&self) -> usize

Height of the viewport in lines.
source§

fn total_lines(&self) -> usize

Total number of lines in the buffer, this includes scrollback and visible lines.
source§

fn last_column(&self) -> Column

Index for the last column.
source§

fn topmost_line(&self) -> Line

Line farthest up in the grid history.
source§

fn bottommost_line(&self) -> Line

Line farthest down in the grid history.
source§

fn history_size(&self) -> usize

Number of invisible lines part of the scrollback history.
source§

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

source§

fn input(&mut self, c: char)

A character to be displayed.

source§

fn put_tab(&mut self, count: u16)

Insert tab at cursor position.

source§

fn backspace(&mut self)

Backspace.

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( &mut self, prefix: String, index: usize, terminator: &str )

Respond to a color query escape sequence.

source§

fn reset_color(&mut self, index: usize)

Reset the indexed color to original value.

source§

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

Store data into clipboard.

source§

fn clipboard_load(&mut self, clipboard: u8, terminator: &str)

Load data from clipboard.

source§

fn reset_state(&mut self)

Reset all important fields in the term struct.

source§

fn terminal_attribute(&mut self, attr: Attr)

Set a terminal attribute.

source§

fn decaln(&mut self)

Run the decaln routine.
source§

fn goto(&mut self, line: i32, col: usize)

Set cursor to position.
source§

fn goto_line(&mut self, line: i32)

Set cursor to specific row.
source§

fn goto_col(&mut self, col: usize)

Set cursor to specific column.
source§

fn insert_blank(&mut self, count: usize)

Insert blank characters in current line starting from cursor.
source§

fn move_up(&mut self, lines: usize)

Move cursor up rows.
source§

fn move_down(&mut self, lines: usize)

Move cursor down rows.
source§

fn move_forward(&mut self, cols: usize)

Move cursor forward cols.
source§

fn move_backward(&mut self, cols: usize)

Move cursor backward cols.
source§

fn identify_terminal(&mut self, intermediate: Option<char>)

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

fn report_keyboard_mode(&mut self)

Report current keyboard mode.
source§

fn push_keyboard_mode(&mut self, mode: KeyboardModes)

Push keyboard mode into the keyboard mode stack.
source§

fn pop_keyboard_modes(&mut self, to_pop: u16)

Pop the given amount of keyboard modes from the keyboard mode stack.
source§

fn set_keyboard_mode( &mut self, mode: KeyboardModes, apply: KeyboardModesApplyBehavior )

Set the keyboard mode using the given behavior.
source§

fn device_status(&mut self, arg: usize)

Report device status.
source§

fn move_down_and_cr(&mut self, lines: usize)

Move cursor down rows and set to column 1.
source§

fn move_up_and_cr(&mut self, lines: usize)

Move cursor up rows and set to column 1.
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: usize)

Scroll up rows rows.
source§

fn scroll_down(&mut self, lines: usize)

Scroll down rows rows.
source§

fn insert_blank_lines(&mut self, lines: usize)

Insert count blank lines.
source§

fn delete_lines(&mut self, lines: usize)

Delete count lines.
source§

fn erase_chars(&mut self, count: usize)

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

fn delete_chars(&mut self, count: usize)

Delete count chars. Read more
source§

fn move_backward_tabs(&mut self, count: u16)

Move backward count tabs.
source§

fn move_forward_tabs(&mut self, count: u16)

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 reverse_index(&mut self)

Reverse Index. Read more
Set hyperlink.
source§

fn set_private_mode(&mut self, mode: PrivateMode)

Set private mode.
source§

fn unset_private_mode(&mut self, mode: PrivateMode)

Unset private mode.
source§

fn report_private_mode(&mut self, mode: PrivateMode)

DECRPM - report private mode.
source§

fn set_mode(&mut self, mode: Mode)

Set mode.
source§

fn unset_mode(&mut self, mode: Mode)

Unset mode.
source§

fn report_mode(&mut self, mode: Mode)

DECRPM - report mode.
source§

fn set_scrolling_region(&mut self, top: usize, bottom: Option<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 set_cursor_shape(&mut self, shape: CursorShape)

Set the cursor shape.
source§

fn set_title(&mut self, title: Option<String>)

OSC to set window title.
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§

fn text_area_size_pixels(&mut self)

Report text area size in pixels.
source§

fn text_area_size_chars(&mut self)

Report text area size in characters.
source§

fn set_mouse_cursor_icon(&mut self, _: CursorIcon)

Set mouse cursor icon.
source§

fn set_modify_other_keys(&mut self, _mode: ModifyOtherKeys)

Set XTerm’s ModifyOtherKeys option.
source§

fn report_modify_other_keys(&mut self)

Report XTerm’s ModifyOtherKeys state. Read more

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