Turbo Vision - Rust TUI 图书馆文档网站 · 开始使用 · 用户指南 · 教程 · 与 C++ 的比较 ·…
Turbo Vision - Rust TUI 图书馆文档网站 · 开始使用 · 用户指南 · 教程 · 与 C++ 的比较 ·…
Documentation site · Getting started · User guide · Tutorials · vs. C++ · What's new · Upgrading to 3.0
A Rust implementation of the classic Borland Turbo Vision text user interface framework.
Full documentation, user guide, tutorials and a side-by-side comparison with the original C++ application model live at tv.enzolombardi.net.
Version 3.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!
The showcase demo with Calculator, Calendar, ASCII Table, and Puzzle windows demonstrating overlapping window management, z-ordering, and shadows.
A full-featured text editor (pascal_ide) editing its own source code, with menu bar, status line, and scrollable editing area.
Context-sensitive help system (F1) with scrollable content, rendered over the editor window.
A tree view widget displaying a hierarchical file system with expandable/collapsible directories, keyboard navigation, and selection highlighting.
The built-in file dialog with directory navigation, file list, and keyboard/mouse support.
TView::origin; views draw at (0,0) and the owners translate (see docs/OWNER-COORDINATES.md)Attr::new(fg, bg).bold().italic(), emitted as real SGR codes on the terminal and in ANSI dumps (see cargo run --example text_styling)Application::set_block_edit_mode, CM_TOGGLE_BLOCK_MODE) rather than a modifier key; CM_SELECT_ALL command and Ctrl+A select all content of the focused windowdump_screen/dump_region/dump_to_file…Tip: Capture the screen at any time —
screen-YYYYMMDD-HHMMSS.ans (view it with cat or less -R).screenshot-YYYYMMDD-HHMMSS.png.For programmatic use, see Terminal::dump_screen(path), Terminal::dump_region(...), and Terminal::save_screenshot_png(path).
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 Result> {
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:
Application::run_with takes an AppHandler for the program's own commands (Borland's TApplication::handleEvent and idle overrides); Application::execute_modal is the one modal loop behind Dialog::executeendModal() pattern to exit event loops; CloseOn says which commands close a dialogTView > TGroup > TWindow > TDialog is expressed as layered traits over shared cores: every view owns a ViewCore, GroupLike and WindowLike carry TGroup's and TWindow's behaviour as group_* / window_* default methods, and a window-shaped type gets its View impl from impl_view_for_window! with overrides written inline. Overrides are late-bound: Dialog::get_palette is what window_draw paints with. See docs/MISSING-INHERITANCE.md for the analysis behind it.drawUnderRect pattern for efficient updatesTGroup::handleEvent()Terminal::put_event() matching Borland's TProgram::putEvent()Group::broadcast() matching Borland's message(owner, ...) patternA non-exhaustive map of the main types. Traits are marked <>; dashed hollow arrows are trait implementations, filled diamonds are ownership by value. The full page with notes lives in docs/CLASS-DIAGRAM.md.
…===============================================================================
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.
暂无开放 Issues,或尚未同步最近议题。