Expand description
One terminal: the PTY, the screen model, the read loop and the small interface a seat drives.
The event loop is forge’s own. alacritty_terminal’s EventLoop
reads the PTY internally and only reports Wakeup, so the raw bytes never
reach a listener - and the client’s stream is exactly those bytes. This
module runs the same loop with the tap: poll, read, scan for OSC 133, send
the bytes on, parse them into Term, and write the terminal’s own
responses back.
One thread per terminal. The read loop owns the Pty; writes go
through a cloned master fd, and a resize is a message to the loop because
TIOCSWINSZ is the Pty’s to make.
Re-exports§
use std::collections::HashMap;🔒use std::io::Read;🔒use std::io::Write;🔒use std::path::Path;🔒use std::path::PathBuf;🔒use std::sync::Arc;🔒use std::sync::atomic::AtomicBool;🔒use std::sync::atomic::AtomicU16;🔒use std::sync::atomic::AtomicU32;🔒use std::sync::atomic::AtomicU64;🔒use std::sync::atomic::Ordering;🔒use std::time::Duration;🔒use std::time::Instant;🔒use alacritty_terminal::event::Event;🔒use alacritty_terminal::event::EventListener;🔒use alacritty_terminal::event::OnResize;🔒use alacritty_terminal::event::WindowSize;🔒use alacritty_terminal::grid::Dimensions;🔒use alacritty_terminal::sync::FairMutex;🔒use alacritty_terminal::term::Config;🔒use alacritty_terminal::term::Term;🔒use alacritty_terminal::tty;🔒use alacritty_terminal::tty::ChildEvent;🔒use alacritty_terminal::tty::EventedPty;🔒use alacritty_terminal::tty::EventedReadWrite;🔒use alacritty_terminal::tty::Options;🔒use alacritty_terminal::tty::Shell;🔒use alacritty_terminal::vte::ansi::Processor;🔒use parking_lot::Mutex;🔒use rustix::event::PollFd;🔒use rustix::event::PollFlags;🔒use rustix::event::Timespec;🔒use rustix::event::poll;🔒use rustix::process::Pid;🔒use rustix::process::Signal;🔒use rustix::process::kill_process_group;🔒use tokio::sync::broadcast;🔒use tokio::sync::watch;🔒use crate::osc::Osc133;🔒use crate::parser;🔒use crate::screen;🔒use crate::screen::ReadResult;🔒use crate::screen::Screen;🔒use crate::shell;🔒use crate::state;🔒use crate::state::ClassifyInput;🔒use crate::state::Exit;🔒use crate::state::State;🔒
Structs§
- Inner 🔒
- Listener 🔒
- The listener
Termreports its own responses through. - Output
Chunk - One chunk of the terminal’s output, with its per-terminal sequence.
- Size 🔒
- Terminal
- One terminal.
- Terminal
Config - What a terminal is spawned with.
Enums§
- Error
- Why a terminal could not be spawned or driven.
Constants§
- MAX_
COLS - MAX_
ROWS - MIN_
COLS - The smallest and largest size a terminal may take. Zero columns underflows alacritty’s grid arithmetic.
- MIN_
ROWS - OUTPUT_
BACKLOG 🔒 - The most output one broadcast keeps for a viewer that is not reading.
- QUIET 🔒
- How long the screen must be quiet before the fallback reads it as a prompt.
- WRITE_
RETRIES 🔒 - How many times a nonblocking write retries before it gives up.
Functions§
- drain_
responses 🔒 - Write the terminal’s own responses (a device-attributes answer, a colour report) back to the PTY, and keep the title the shell set.
- exit_
signal 🔒 - The signal a process died from, when it did.
- last_
nonempty_ 🔒line - The last non-empty line on the visible screen.
- poll_
ended 🔒 - Whether a poll’s flags say the terminal is over: the slave side is gone or the fd errored, so no byte can arrive again.
- read_
loop 🔒 - The read loop: poll, read, tap, parse, respond, and notice the child.
- read_
ready 🔒 - Read everything the PTY has, tap it, parse it, and answer the terminal’s own queries.