Terminal
保持型の Ghostty ターミナルサーフェスを埋め込み、プロセスのライフサイクルイベントを通知します。
#インポート
quickgui から Terminal をインポートします。
use quickgui::*;#使い方
let terminal = Terminal::spawn(
TerminalOptions {
program: Some("/bin/zsh".into()),
arguments: vec!["-l".into()],
working_directory: Some(directory.into()),
..TerminalOptions::default()
},
cx.window_invalidator(),
)?;
terminal.element(cx)#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
Terminal
ソースを見るpub fn spawn( options: TerminalOptions, invalidator: WindowInvalidator, ) -> Result<Self, TerminalError>Start a PTY and terminal-emulation worker. Process-launch failures are published through [`TerminalSnapshot::status`] so a declarative terminal remains mounted and informative.
snapshotpub fn snapshot(&self) -> Arc<TerminalSnapshot>—
Read the latest complete terminal frame without locking the emulator or PTY.
pub fn snapshot(&self) -> Arc<TerminalSnapshot>ソースを見るwritepub fn write(&self, bytes: impl AsRef<[u8]>) -> bool—
Write raw bytes to the PTY. Prefer normal keyboard events or [`Self::paste`] for user input.
pub fn write(&self, bytes: impl AsRef<[u8]>) -> boolソースを見るpastepub fn paste(&self, value: impl Into<String>) -> bool—
Encode text using libghostty's bracketed-paste and control-byte rules, then write it.
pub fn paste(&self, value: impl Into<String>) -> boolソースを見るscroll_rowspub fn scroll_rows(&self, rows: isize) -> bool—
Scroll libghostty's retained viewport by terminal rows. Negative values move into history.
pub fn scroll_rows(&self, rows: isize) -> boolソースを見るresizepub fn resize(&self, cols: u16, rows: u16, cell_width_px: u32, cell_height_px: u32) -> bool—
Resize both the PTY and libghostty viewport, coalescing identical measurements.
pub fn resize(&self, cols: u16, rows: u16, cell_width_px: u32, cell_height_px: u32) -> boolソースを見るTerminal::element
ソースを見るpub fn element<V: 'static>( &self, id: impl Into<ElementId>, style: TerminalStyle, cx: &mut ViewContext<'_, V>, ) -> ElementBuild the complete retained terminal surface, including focus, keyboard, paste, scroll, and exact bounds-to-PTY resize behavior.
