| Crates.io | turbo-vision |
| lib.rs | turbo-vision |
| version | 1.0.2 |
| created_at | 2025-11-02 13:01:00.980437+00 |
| updated_at | 2025-12-15 16:41:13.235259+00 |
| description | A Rust implementation of the classic Borland Turbo Vision text-mode UI framework |
| homepage | https://github.com/aovestdipaperino/turbo-vision-4-rust |
| repository | https://github.com/aovestdipaperino/turbo-vision-4-rust |
| max_upload_size | |
| id | 1913105 |
| size | 1,641,835 |

A Rust implementation of the classic Borland Turbo Vision text user interface framework.
Version 1.0.0 - PRODUCTION READY ✅
Based on kloczek Borland Turbo Vision C++ port here
Other C++ implementations:
This port achieves 100% API parity with kloczek port of Borland Turbo Vision C++. All features from the original framework have been implemented. While the codebase is complete and production-ready, it may contain bugs. Please report any issues you encounter!
use turbo_vision::prelude::*;
fn main() -> turbo_vision::core::error::Result<()> {
// Create a window
let mut dialog = turbo_vision::views::dialog::DialogBuilder::new().bounds(Rect::new(10, 5, 50, 15)).title("My First Dialog").build();
// Create a button and add it to the window
let button = turbo_vision::views::button::Button::new(Rect::new(26, 6, 36, 8), "Quit", turbo_vision::core::command::CM_OK, true);
dialog.add(Box::new(button));
// Create the application and add the dialog to its desktop
let mut app = Application::new()?;
app.desktop.add(Box::new(dialog));
// Event loop
app.running = true;
while app.running {
app.desktop.draw(&mut app.terminal);
app.terminal.flush()?;
if let Ok(Some(mut event)) = app.terminal.poll_event(std::time::Duration::from_millis(50)) {
app.desktop.handle_event(&mut event);
if event.command == CM_OK {
// Handle button click
app.running = false;
}
}
}
Ok(())
}
Tip: Press F12 at any time to capture full screen to screen-dump.txt, or F11 to capture active window/dialog to active-view-dump.txt - both with a visual flash effect for debugging!
The color palette system accurately replicates Borland Turbo Vision's behavior:
app.set_palette() for custom themesThe palette system uses a three-level mapping chain:
You can customize the entire application palette at runtime to create custom themes:
// Create a custom palette (63 bytes, each encoding foreground << 4 | background)
let dark_palette = vec![/* 63 color bytes */];
// Set the palette - redraw happens automatically!
app.set_palette(Some(dark_palette));
// Reset to default Borland palette
app.set_palette(None);
See examples/palette_themes_demo.rs for a complete example with multiple themes.
This project includes extensive documentation for different audiences and use cases. Here's a recommended reading order based on your goals:
If you're new to Turbo Vision frameworks, follow this path:
cargo run --example showcase # Comprehensive feature showcase
cargo run --bin rust_editor # Full-featured text editor
Continue with: Chapters 4-18 in the User Guide for comprehensive coverage of all features.
For practical application development:
If you're familiar with Borland Turbo Vision:
Key Differences: The Rust port uses composition over inheritance, but maintains the same event loop patterns, drawing system, and API structure as Borland's original.
When you need specific functionality:
For API lookups and function signatures:
cargo doc --open for generated documentationIf you want to modify or extend the codebase:
src/views/*/tests modulesdocs/
├── DOCUMENTATION-INDEX.md # Master index
├── RUST-CODING-GUIDELINES.md # Code style guide
├── CUSTOM-APPLICATION-RUST-EXAMPLE.md # Complete app walkthrough
├── BIORHYTHM-CALCULATOR-TUTORIAL.md # Step-by-step tutorial
├── PALETTE-SYSTEM.md # Color system explained
├── BORLAND-PALETTE-CHART.md # Color reference
├── RUST-API-CATALOG.md # API reference
├── TURBO-VISION-DESIGN.md # Complete design document
├── SERIALIZATION-PERSISTENCE.md # Saving/loading data
└── user-guide/ # 18-chapter comprehensive guide
├── Chapter-01-Stepping-into-Turbo-Vision.md
├── Chapter-02-Responding-to-Commands.md
├── ... (Chapters 3-17)
└── Chapter-18-Resources.md
examples/
├── README.md # Examples index with descriptions
├── showcase.rs # Comprehensive demo
├── biorhythm.rs # Complete calculator app
└── ... (30+ more examples)
demo/
└── rust_editor.rs # Production text editor
Start Coding: Quick Start → Examples
Learn Concepts: User Guide Chapter 1
Build an App: Custom Application Example
Get Help: Documentation Index
Report Issues: GitHub Issues
Currently implements:
Turbo Vision can serve TUI applications over SSH connections, enabling remote terminal access to your application. This is useful for admin consoles, monitoring dashboards, and tools that need to be accessed remotely.
SSH support is behind a feature flag. Enable it in your Cargo.toml:
[dependencies]
turbo-vision = { version = "1.0", features = ["ssh"] }
Or build with the feature:
cargo build --features ssh
use turbo_vision::prelude::*;
use turbo_vision::terminal::{Backend, SshBackend, SshSessionBuilder};
use turbo_vision::ssh::{SshServer, SshServerConfig};
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = SshServerConfig::default();
let server = SshServer::new(config)?;
server.run("0.0.0.0:2222", |backend| {
// Create Terminal with SSH backend
let terminal = Terminal::with_backend(backend).unwrap();
run_your_tui_app(terminal);
}).await?;
Ok(())
}
# Start the SSH server
cargo run --example ssh_server --features ssh
# Connect from another terminal
ssh -p 2222 user@localhost
# Password: any (accepts any password in the example)
The SSH support uses a Backend trait abstraction:
This allows the same TUI application to run locally or over SSH with no code changes.
This implementation closely follows Borland Turbo Vision's architecture, adapted for Rust:
Group (matching Borland's TGroup::execute()), not in individual viewsendModal() pattern to exit event loopsWindow contains Group, Dialog wraps Window)drawUnderRect pattern for efficient updatesTGroup::handleEvent()Terminal::put_event() matching Borland's TProgram::putEvent()Group::broadcast() matching Borland's message(owner, ...) pattern===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
Rust 125 37315 28029 3557 5729
|- Markdown 102 4695 332 3604 759
(Total) 42010 28361 7161 6488
===============================================================================
Generated with tokei - includes inline documentation
226 unit tests - all passing ✅
MIT License - see LICENSE file for details.