Struct vt100::Screen [−][src]
pub struct Screen { /* fields omitted */ }
Expand description
Represents the overall terminal state.
Implementations
Returns the current size of the terminal.
The return value will be (rows, cols).
Returns the current position in the scrollback.
This position indicates the offset from the top of the screen, and is
0
when the normal screen is in view.
Returns the text contents of the terminal.
This will not include any formatting information, and will be in plain text format.
Returns the text contents of the terminal by row, restricted to the given subset of columns.
This will not include any formatting information, and will be in plain text format.
Newlines will not be included.
Returns the text contents of the terminal logically between two cells.
This will include the remainder of the starting row after start_col
,
followed by the entire contents of the rows between start_row
and
end_row
, followed by the beginning of the end_row
up until
end_col
. This is useful for things like determining the contents of
a clipboard selection.
Return escape codes sufficient to reproduce the entire contents of the
current terminal state. This is a convenience wrapper around
contents_formatted
, input_mode_formatted
, and title_formatted
.
Return escape codes sufficient to turn the terminal state of the
screen prev
into the current terminal state. This is a convenience
wrapper around contents_diff
, input_mode_diff
, title_diff
, and
bells_diff
.
Returns the formatted visible contents of the terminal.
Formatting information will be included inline as terminal escape codes. The result will be suitable for feeding directly to a raw terminal parser, and will result in the same visual output.
Returns the formatted visible contents of the terminal by row, restricted to the given subset of columns.
Formatting information will be included inline as terminal escape codes. The result will be suitable for feeding directly to a raw terminal parser, and will result in the same visual output.
You are responsible for positioning the cursor before printing each row, and the final cursor position after displaying each row is unspecified.
Returns a terminal byte stream sufficient to turn the visible contents
of the screen described by prev
into the visible contents of the
screen described by self
.
The result of rendering prev.contents_formatted()
followed by
self.contents_diff(prev)
should be equivalent to the result of
rendering self.contents_formatted()
. This is primarily useful when
you already have a terminal parser whose state is described by prev
,
since the diff will likely require less memory and cause less
flickering than redrawing the entire screen contents.
Returns a sequence of terminal byte streams sufficient to turn the
visible contents of the subset of each row from prev
(as described
by start
and width
) into the visible contents of the corresponding
row subset in self
.
You are responsible for positioning the cursor before printing each row, and the final cursor position after displaying each row is unspecified.
Returns terminal escape sequences sufficient to set the current terminal’s input modes.
Supported modes are:
- application keypad
- application cursor
- bracketed paste
- xterm mouse support
Returns terminal escape sequences sufficient to change the previous terminal’s input modes to the input modes enabled in the current terminal.
Returns terminal escape sequences sufficient to set the current terminal’s window title.
Returns terminal escape sequences sufficient to change the previous terminal’s window title to the window title set in the current terminal.
Returns terminal escape sequences sufficient to cause audible and
visual bells to occur if they have been received since the terminal
described by prev
.
Returns terminal escape sequences sufficient to set the current terminal’s drawing attributes.
Supported drawing attributes are:
- fgcolor
- bgcolor
- bold
- italic
- underline
- inverse
This is not typically necessary, since contents_formatted
will leave
the current active drawing attributes in the correct state, but this
can be useful in the case of drawing additional things on top of a
terminal output, since you will need to restore the terminal state
without the terminal contents necessarily being the same.
Returns the current cursor position of the terminal.
The return value will be (row, col).
Returns terminal escape sequences sufficient to set the current cursor state of the terminal.
This is not typically necessary, since contents_formatted
will leave
the cursor in the correct state, but this can be useful in the case of
drawing additional things on top of a terminal output, since you will
need to restore the terminal state without the terminal contents
necessarily being the same.
Note that the bytes returned by this function may alter the active
drawing attributes, because it may require redrawing existing cells in
order to position the cursor correctly (for instance, in the case
where the cursor is past the end of a row). Therefore, you should
ensure to reset the active drawing attributes if necessary after
processing this data, for instance by using attributes_formatted
.
Returns the Cell
object at the given location in the terminal, if it
exists.
Returns whether the text in row row
should wrap to the next line.
Returns a value which changes every time an audible bell is received.
Typically you would store this number after each call to process
,
and trigger an audible bell whenever it changes.
You shouldn’t rely on the exact value returned here, since the exact
value will not be maintained by contents_formatted
or
contents_diff
.
Returns a value which changes every time an visual bell is received.
Typically you would store this number after each call to process
,
and trigger an visual bell whenever it changes.
You shouldn’t rely on the exact value returned here, since the exact
value will not be maintained by contents_formatted
or
contents_diff
.
Returns the number of parsing errors seen so far.
Currently this only tracks invalid UTF-8 and control characters other
than 0x07
-0x0f
. This can give an idea of whether the input stream
being fed to the parser is reasonable or not.
Returns whether the alternate screen is currently in use.
Returns whether the terminal should be in application keypad mode.
Returns whether the terminal should be in application cursor mode.
Returns whether the terminal should be in hide cursor mode.
Returns whether the terminal should be in bracketed paste mode.
Returns the currently active MouseProtocolMode
Returns the currently active MouseProtocolEncoding
Returns whether newly drawn text should be rendered with the bold text attribute.
Returns whether newly drawn text should be rendered with the italic text attribute.
Returns whether newly drawn text should be rendered with the underlined text attribute.
Trait Implementations
The final character of an escape sequence has arrived. Read more
A final character has arrived for a CSI sequence Read more
Dispatch an operating system command.
Invoked when a final character arrives in first part of device control string. Read more
Pass bytes as part of a device control string to the handle chosen in hook
. C0 controls
will also be passed to the handler. Read more
Auto Trait Implementations
impl RefUnwindSafe for Screen
impl UnwindSafe for Screen
Blanket Implementations
Mutably borrows from an owned value. Read more