egui_simple_term
A small, embeddable terminal widget for 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. What those commands do is entirely up to you.
Features
- Colored prompt, input, and cursor — each part of the line is styled independently via a [
Palette]. - Full line editing — cursor movement,
Home/End,Backspace/Delete, and paste. - Command history — arrow-up / arrow-down to recall previous commands.
- Scrollable backlog — print output with [
Terminal::writeln_grid]; it scrolls and sticks to the bottom. - No dependencies beyond
eframe— drop it into any egui app.
Installation
Add it to your Cargo.toml:
[]
= "0.1"
Requires Rust 1.88 or later.
Quick start
use ;
use ;
A slightly longer, runnable example lives in examples/demo.rs:
API
The public surface is deliberately tiny:
| Type | What it is |
|---|---|
[Terminal] |
The widget. Call [Terminal::show] every frame; it returns the submitted command. |
[Palette] |
The three colors — prompt_color, record_color, cursor_color. |
[Line] / [CellGroup] |
The low-level data model behind the backlog, exposed for advanced use. |
Key bindings
While the terminal has focus:
| Keys | Action |
|---|---|
| Printable characters, paste | Insert text at the cursor |
| ← / → | Move the cursor |
Home / End |
Jump to the start / end of the line |
Backspace / Delete |
Delete before / at the cursor |
| ↑ / ↓ | Previous / next history entry |
Enter |
Submit (returned by [Terminal::show]) |
Customizing colors
use Palette;
let palette = Palette ;
License
Licensed under the MIT license.