egui_simple_term 0.1.0

A small embeddable terminal widget for egui: a colored prompt, line editing, command history, and a scrollable output backlog.
Documentation
//! A small, embeddable terminal widget for [`egui`](eframe::egui).
//!
//! It renders an interactive command line — a colored prompt, the text you are
//! typing, a block cursor, and a scrollable backlog of output — and hands each
//! submitted command back to your app as a [`String`](alloc::string::String).
//! What those commands *do* is entirely up to you.
//!
//! The public surface is deliberately tiny:
//!
//! - [`Terminal`] — the widget. Call [`Terminal::show`] every frame.
//! - [`Palette`] — the three colors (`prompt_color`, `record_color`,
//!   `cursor_color`).
//! - [`Line`] / [`CellGroup`] — the low-level data model behind the backlog,
//!   exposed for advanced use.
//!
//! # Quick start
//!
//! ```no_run
//! use eframe::{
//!     App, Frame, NativeOptions, Result as EframeResult,
//!     egui::{CentralPanel, Ui, ViewportBuilder},
//! };
//! use egui_simple_term::{Palette, Terminal};
//!
//! struct Repl {
//!     term: Terminal,
//! }
//!
//! impl App for Repl {
//!     fn ui(&mut self, ui: &mut Ui, _frame: &mut Frame) {
//!         // Drive the terminal from a panel; `show` handles input + painting.
//!         CentralPanel::no_frame().show(ui, |ui| {
//!             if let Some(command) = self.term.show(ui) {
//!                 // `command` is the text the user typed, without the prompt.
//!                 self.term.writeln_grid(&format!("unknown command: {command}"));
//!             }
//!         });
//!     }
//! }
//!
//! fn main() -> EframeResult {
//!     let options = NativeOptions {
//!         viewport: ViewportBuilder::default().with_inner_size([800.0, 600.0]),
//!         ..Default::default()
//!     };
//!     eframe::run_native(
//!         "repl",
//!         options,
//!         Box::new(|_cc| Ok(Box::new(Repl {
//!             term: Terminal::new("> ", Palette::default()),
//!         }))),
//!     )
//! }
//! ```
//!
//! A complete, runnable version lives in `examples/demo.rs` — run it with
//! `cargo run --example demo`.

#![no_std]
extern crate alloc;

mod utils;

pub mod cell_group;
pub mod line;
pub mod palette;
pub mod term;

pub use cell_group::CellGroup;
pub use line::Line;
pub use palette::Palette;
pub use term::Terminal;