pub struct Session { /* private fields */ }Expand description
The real terminal: keys from it, paints to standard output or standard
error (SessionOptions::output), through the library
SessionOptions::backend names.
Implementations§
Source§impl Session
impl Session
Sourcepub fn start(options: SessionOptions) -> Result<Session>
pub fn start(options: SessionOptions) -> Result<Session>
Turn on raw mode and the options. Fails, changing nothing, when the terminal cannot do raw mode or another session is alive.
pub fn options(&self) -> SessionOptions
Sourcepub fn kitty_keys(&self) -> bool
pub fn kitty_keys(&self) -> bool
Whether keys are read with the kitty keyboard protocol: the terminal
has it, the backend reads it, and SessionOptions::legacy_keys is
off. Every key is then exact, and with
crossterm releases arrive.
Sourcepub fn releases_reported(&self) -> Releases
pub fn releases_reported(&self) -> Releases
Which key releases arrive as Event::KeyUp: with crossterm and
the kitty keyboard protocol, every key’s but the text keys’, or
every key’s with SessionOptions::all_keys; every key’s on the
Windows console; none otherwise.
Sourcepub fn synchronized_output(&self) -> bool
pub fn synchronized_output(&self) -> bool
Whether frames are written as synchronized updates: forced by
SessionOptions::synchronized_output or RICH_SYNC_OUTPUT, or
the terminal answered that it knows mode 2026.
Sourcepub fn color_system(&self) -> Option<Option<ColorSystem>>
pub fn color_system(&self) -> Option<Option<ColorSystem>>
The colours the backend’s own probe of the terminal found, when it
has one (termwiz’s: terminfo and COLORTERM); None to leave it to
rich’s detection. Some(None) is no colour.
Trait Implementations§
Source§impl Backend for Session
impl Backend for Session
Source§fn waker(&mut self) -> Option<Waker>
fn waker(&mut self) -> Option<Waker>
The session’s Waker: on Unix the terminal and it are waited on
in one poll, on every backend; elsewhere a read looks at it every
few milliseconds.
Source§fn read(&mut self, timeout: Option<Duration>) -> Result<Option<Event>>
fn read(&mut self, timeout: Option<Duration>) -> Result<Option<Event>>
None when timeout passes first. None for
timeout waits as long as it takes.Source§fn releases_reported(&self) -> Releases
fn releases_reported(&self) -> Releases
Releases). The default: none.Source§fn synchronized_output(&self) -> bool
fn synchronized_output(&self) -> bool
write_frame writes each frame as
one synchronized update. The default: no.Source§fn clipboard(&self) -> Result<(), String>
fn clipboard(&self) -> Result<(), String>
copy reaches a clipboard (#488): Ok
when it does, or why not. The default: it does not.Source§fn elapsed(&self) -> Duration
fn elapsed(&self) -> Duration
Source§fn handoff(&mut self, command: &mut Command) -> Result<Option<i32>>
fn handoff(&mut self, command: &mut Command) -> Result<Option<i32>>
command with the terminal as it was before the session, then
take the terminal back. Returns the exit code.Source§fn alternate_screen(&self) -> bool
fn alternate_screen(&self) -> bool
Source§fn origin(&self) -> u16
fn origin(&self) -> u16
Source§fn can_suspend(&self) -> bool
fn can_suspend(&self) -> bool
Source§fn suspend(&mut self) -> Result<()>
fn suspend(&mut self) -> Result<()>
can_suspend.Source§fn take_resumed(&mut self) -> bool
fn take_resumed(&mut self) -> bool
Source§fn write_frame(&mut self, frame: &str) -> Result<()>
fn write_frame(&mut self, frame: &str) -> Result<()>
synchronized_output
between CSI ? 2026 h and CSI ? 2026 l, in the one write.