pub struct Term { /* private fields */ }Expand description
A representation of a terminal.
Implementations§
Source§impl Term
impl Term
Sourcepub fn new(scrollback_lines: usize, size: Size) -> Self
pub fn new(scrollback_lines: usize, size: Size) -> Self
Create a new terminal with the given width and height.
Note that width will only be used when generated output to determine where wrapping should be place.
scrollback_lines must be at least size.height. If it is less than size.height, it will be automatically adjusted to be equal to size.height.
Sourcepub fn resize(&mut self, size: Size)
pub fn resize(&mut self, size: Size)
Set the terminal size.
This will implicitly size up the scrollback_lines if it is currently less than size.height.
Sourcepub fn scrollback_lines(&self) -> usize
pub fn scrollback_lines(&self) -> usize
Get the current number of lines of stored scrollback.
Sourcepub fn set_scrollback_lines(&mut self, scrollback_lines: usize)
pub fn set_scrollback_lines(&mut self, scrollback_lines: usize)
Set the number of lines of scrollback to store. This will drop data when resizing down. When resizing up, no new memory is allocated, capacity is simply expanded.
If the given value is less than size().height, it will be overridden to match the current height. You cannot store less scrollback than there are lines in the visible screen region.
Sourcepub fn process(&mut self, buf: &[u8])
pub fn process(&mut self, buf: &[u8])
Process the given chunk of input. This should be the data read off a pty running a shell.
Sourcepub fn contents(&self, dump_region: ContentRegion) -> Vec<u8> ⓘ
pub fn contents(&self, dump_region: ContentRegion) -> Vec<u8> ⓘ
Get the current contents of the terminal encoded via terminal escape sequences. The contents buffer will be prefixed with a reset code, so inputing this to any terminal emulator will reset the emulator to the contents of this Term instance.