pub struct TermState {
pub prompt: String,
pub mode: u8,
pub flags: u32,
pub font: Option<u32>,
pub size_pt: f32,
pub pager_text: String,
pub page_len: u16,
/* private fields */
}Expand description
the state of one console (see the module header); the app keeps it between frames
Fields§
§prompt: Stringthe text before the input (SGR allowed)
mode: u8TM_LINE, TM_BUSY, TM_RAW, TM_SECRET
flags: u32TF_* added to the flags of ui.terminal
font: Option<u32>a font id for this console (None: ui.mono_font)
size_pt: f32the text size in points (default 10)
pager_text: Stringthe pager’s line (default “ –More– “)
page_len: u16lines of output per page of the pager (0, the default: the screen minus one line)
Implementations§
Source§impl TermState
impl TermState
Sourcepub fn write(&mut self, s: &[u8])
pub fn write(&mut self, s: &[u8])
output: UTF-8 with the ANSI subset of the module header (paged while the pager is on)
Sourcepub fn set_prompt(&mut self, s: &str)
pub fn set_prompt(&mut self, s: &str)
the prompt before the input (SGR allowed)
Sourcepub fn input_set(&mut self, s: &str, caret: usize)
pub fn input_set(&mut self, s: &str, caret: usize)
replace the input line; caret: a byte index (clamped to a character start)
Sourcepub fn complete_reply<S: AsRef<str>>(&mut self, line: &str, list: &[S])
pub fn complete_reply<S: AsRef<str>>(&mut self, line: &str, list: &[S])
the answer to TermEv::Complete: the new input line (caret at its end); a non-empty list is shown in columns below the line as typed
Sourcepub fn pager(&mut self, on: bool)
pub fn pager(&mut self, on: bool)
on: the following output pages (see the module header); off: the app wrote all of it
Sourcepub fn pager_waiting(&self) -> bool
pub fn pager_waiting(&self) -> bool
the pager holds output and waits for a key
Sourcepub fn grid(&self) -> (u16, u16)
pub fn grid(&self) -> (u16, u16)
the character grid of the last layout (columns, rows; 0 before the first)
Sourcepub fn text(&self) -> String
pub fn text(&self) -> String
the scrollback and the current line as plain text (lines joined with ‘\n’)
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
lines kept in the scrollback