Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 62 variants Print(char), Newline, CarriageReturn, Tab, Backspace, Bell, CursorUp(u16), CursorDown(u16), CursorRight(u16), CursorLeft(u16), CursorNextLine(u16), CursorPrevLine(u16), CursorColumn(u16), CursorRow(u16), SetScrollRegion { top: u16, bottom: u16, }, ScrollUp(u16), ScrollDown(u16), InsertLines(u16), DeleteLines(u16), InsertChars(u16), DeleteChars(u16), CursorPosition { row: u16, col: u16, }, EraseInDisplay(u8), EraseInLine(u8), Sgr(CsiParams), DecSet(CsiParams), DecRst(CsiParams), AnsiSet(CsiParams), AnsiRst(CsiParams), SaveCursor, RestoreCursor, Index, ReverseIndex, NextLine, FullReset, SetTitle(String), HyperlinkStart(String), HyperlinkEnd, SetTabStop, ClearTabStop(u16), BackTab(u16), ApplicationKeypad, NormalKeypad, EraseChars(u16), ScreenAlignment, RepeatChar(u16), SetCursorShape(u8), SoftReset, EraseScrollback, FocusIn, FocusOut, PasteStart, PasteEnd, DeviceAttributes, DeviceAttributesSecondary, DeviceStatusReport, CursorPositionReport, DesignateCharset { slot: u8, charset: u8, }, SingleShift2, SingleShift3, MouseEvent { button: u16, col: u16, row: u16, pressed: bool, }, Escape(Vec<u8>),
}
Expand description

Parser output actions.

Variants§

§

Print(char)

Print a single character (ASCII or multi-byte UTF-8).

§

Newline

Line feed / newline (\n).

§

CarriageReturn

Carriage return (\r).

§

Tab

Horizontal tab (\t).

§

Backspace

Backspace (\x08).

§

Bell

Bell (\x07).

§

CursorUp(u16)

CUU (CSI Ps A): move cursor up by count (default 1).

§

CursorDown(u16)

CUD (CSI Ps B): move cursor down by count (default 1).

§

CursorRight(u16)

CUF (CSI Ps C): move cursor right by count (default 1).

§

CursorLeft(u16)

CUB (CSI Ps D): move cursor left by count (default 1).

§

CursorNextLine(u16)

CNL (CSI Ps E): move cursor down by count and to column 0.

§

CursorPrevLine(u16)

CPL (CSI Ps F): move cursor up by count and to column 0.

§

CursorColumn(u16)

CHA (CSI Ps G): move cursor to absolute column (0-indexed).

§

CursorRow(u16)

VPA (CSI Ps d): move cursor to absolute row (0-indexed).

§

SetScrollRegion

DECSTBM (CSI Pt ; Pb r): set scrolling region. bottom == 0 means “use full height” (default), since the parser does not know the grid size.

top is 0-indexed inclusive. bottom is 0-indexed exclusive when non-zero.

Fields

§top: u16
§bottom: u16
§

ScrollUp(u16)

SU (CSI Ps S): scroll the scroll region up by count (default 1).

§

ScrollDown(u16)

SD (CSI Ps T): scroll the scroll region down by count (default 1).

§

InsertLines(u16)

IL (CSI Ps L): insert blank lines at cursor row within scroll region.

§

DeleteLines(u16)

DL (CSI Ps M): delete lines at cursor row within scroll region.

§

InsertChars(u16)

ICH (CSI Ps @): insert blank cells at cursor column.

§

DeleteChars(u16)

DCH (CSI Ps P): delete cells at cursor column.

§

CursorPosition

CUP/HVP: move cursor to absolute 0-indexed row/col.

Fields

§row: u16
§col: u16
§

EraseInDisplay(u8)

ED mode (CSI Ps J): 0, 1, or 2.

§

EraseInLine(u8)

EL mode (CSI Ps K): 0, 1, or 2.

§

Sgr(CsiParams)

SGR (CSI ... m): set graphics rendition parameters (attributes/colors).

Parameters are returned as parsed numeric values; interpretation is performed by the terminal engine (they are stateful/delta-based).

§

DecSet(CsiParams)

DECSET (CSI ? Pm h): enable DEC private mode(s).

§

DecRst(CsiParams)

DECRST (CSI ? Pm l): disable DEC private mode(s).

§

AnsiSet(CsiParams)

SM (CSI Pm h): enable ANSI standard mode(s).

§

AnsiRst(CsiParams)

RM (CSI Pm l): disable ANSI standard mode(s).

§

SaveCursor

DECSC (ESC 7): save cursor state.

§

RestoreCursor

DECRC (ESC 8): restore cursor state.

§

Index

IND (ESC D): index — move cursor down one line, scrolling if at bottom.

§

ReverseIndex

RI (ESC M): reverse index — move cursor up one line, scrolling if at top.

§

NextLine

NEL (ESC E): next line — move cursor to start of next line.

§

FullReset

RIS (ESC c): full reset to initial state.

§

SetTitle(String)

OSC 0/2: set terminal title.

§

HyperlinkStart(String)

OSC 8: start a hyperlink with the given URI.

§

HyperlinkEnd

OSC 8: end the current hyperlink.

§

SetTabStop

HTS (ESC H): set a tab stop at the current cursor column.

§

ClearTabStop(u16)

TBC (CSI Ps g): tab clear. 0 = at cursor, 3 = all tab stops.

§

BackTab(u16)

CBT (CSI Ps Z): cursor backward tabulation by count (default 1).

§

ApplicationKeypad

DECKPAM (ESC =): application keypad mode.

§

NormalKeypad

DECKPNM (ESC >): normal keypad mode.

§

EraseChars(u16)

ECH (CSI Ps X): erase characters at cursor position (replace with blanks).

§

ScreenAlignment

DECALN (ESC # 8): DEC screen alignment test — fill entire grid with ‘E’.

§

RepeatChar(u16)

REP (CSI Ps b): repeat the most recently printed graphic character Ps times.

§

SetCursorShape(u8)

DECSCUSR (CSI Ps SP q): set cursor shape.

0 = default, 1 = blinking block, 2 = steady block, 3 = blinking underline, 4 = steady underline, 5 = blinking bar, 6 = steady bar.

§

SoftReset

DECSTR (CSI ! p): soft terminal reset.

Resets most terminal state (modes, SGR, scroll region, cursor visibility, character sets) without clearing the screen or scrollback — unlike RIS (ESC c) which is a full reset.

§

EraseScrollback

ED mode 3 (CSI 3 J): erase the entire display and scrollback buffer.

§

FocusIn

Focus gained (CSI I): terminal window received focus.

§

FocusOut

Focus lost (CSI O): terminal window lost focus.

§

PasteStart

Bracketed paste start (CSI 200 ~).

§

PasteEnd

Bracketed paste end (CSI 201 ~).

§

DeviceAttributes

DA1 (CSI c / CSI 0 c): request primary device attributes.

§

DeviceAttributesSecondary

DA2 (CSI > c / CSI > 0 c): request secondary device attributes.

§

DeviceStatusReport

DSR (CSI 5 n): device status report — “are you OK?” query.

§

CursorPositionReport

CPR (CSI 6 n): cursor position report — request current cursor position.

§

DesignateCharset

Designate character set for slot G0..G3.

slot: 0 = G0 (ESC (), 1 = G1 (ESC )), 2 = G2 (ESC *), 3 = G3 (ESC +). charset: b’B’ = ASCII (USASCII), b’0’ = DEC Special Graphics, etc.

Fields

§slot: u8
§charset: u8
§

SingleShift2

SS2 (ESC N): single shift to G2 for the next printed character only.

§

SingleShift3

SS3 (ESC O): single shift to G3 for the next printed character only.

§

MouseEvent

Mouse event from SGR mode 1006 (CSI < Pb ; Px ; Py M/m) or legacy X10 mode 1000 (CSI M Cb Cx Cy).

button: 0 = left, 1 = middle, 2 = right, 3 = release (legacy), 64 = scroll up, 65 = scroll down. Modifier bits: 4 = shift, 8 = meta, 16 = ctrl. col/row: 0-based cell coordinates. pressed: true for press/motion, false for release.

Fields

§button: u16
§col: u16
§row: u16
§pressed: bool
§

Escape(Vec<u8>)

A raw escape/CSI/OSC sequence captured verbatim (starts with ESC).

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Action

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Action

Source§

fn eq(&self, other: &Action) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Action

Source§

impl StructuralPartialEq for Action

Auto Trait Implementations§

§

impl Freeze for Action

§

impl RefUnwindSafe for Action

§

impl Send for Action

§

impl Sync for Action

§

impl Unpin for Action

§

impl UnwindSafe for Action

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.