neuron-explorer
Qwen3.5‑4B 전용 조향형 뉴런 탐색기, 모든 MLP 뉴런을 밀어 결과를 보관·탐색
A Rust port of Borland's Turbo Vision: menus, windows, dialogs, validators and editors for the terminal
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
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.
Based on
kloczek Borland Turbo Vision C++ port here
Other C++ implementations:
• Magiblot Turbo Vision for C++
• Borland Original Turbo Vision 2.0.3 codeREADME 전문 보기 ↗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 4.1.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 windowNiche features that version on their own pace live in the separate
tv-extensions crate: an
SSH server (ssh), remote input over TCP for testing and automation
(remote-input), Kitty images and ANSI-art backgrounds (graphics), the log
window and terminal widget (log), a CSV table editor (csv), host-driven
embedding for a non-terminal host such as a WASM guest (host, no feature
flag), plus ScrollPane and popup menus (no feature flag). See
UPGRADING-TO-4.0.md if you used any of these from core
before 4.0.0.
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: 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 << 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 --example gallery # Every component, live, with its code
cargo run --bin pascal_ide # 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
├── CLASS-DIAGRAM.md # Mermaid class diagram of the core types
├── HOW-TO-BUILD-AND-DEPLOY-WEBSITE.md # Building and deploying the MkDocs site
├── 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/
└── pascal_ide.rs # Production text editor
Currently implements:
SSH support moved to tv-extensions
in 4.0.0: tv_extensions::ssh (feature ssh) serves TUI applications over SSH
connections the same way core's removed ssh feature did, built on the same
Backend trait abstraction — SshBackend plugs in beside CrosstermBackend,
and InputParser (still public in core) converts raw bytes to events either
way. See tv-extensions' SSH docs
and UPGRADING-TO-4.0.md.
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 <<trait>>; dashed hollow arrows are trait implementations, filled diamonds are ownership by value. The full page with notes lives in docs/CLASS-DIAGRAM.md.
classDiagram
direction TB
class View {
<<trait>>
+bounds() Rect
+set_bounds(Rect)
+draw(Terminal)
+handle_event(Event)
+can_focus() bool
+set_focus(bool)
+state() StateFlags
+options() u16
+grow_mode() GrowFlags
}
class IdleView {
<<trait>>
+idle()
}
class Cluster {
<<trait>>
+cluster_state()
}
class ListViewer {
<<trait>>
+list_state()
+item_count() usize
}
class MenuViewer {
<<trait>>
+menu_state()
}
class Editor {
<<trait>>
+undo()
+redo()
+cut() bool
+copy() bool
+paste() bool
}
class FileEditor {
<<trait>>
+load(PathBuf)
+save()
+save_as(PathBuf)
}
View <|-- IdleView
View <|-- Cluster
View <|-- ListViewer
View <|-- MenuViewer
View <|-- Editor
Editor <|-- FileEditor
class Application {
+terminal: Terminal
+desktop: Desktop
+menu_bar: Option~MenuBar~
+status_line: Option~StatusLine~
+running: bool
+run()
+handle_event(Event)
}
class Desktop {
-children: Group
+add(Box~View~)
+cascade()
+tile()
+bring_to_front(ViewId)
}
class Group {
-children: Vec~Box~View~~
-focused: usize
-end_state: CommandId
+add(Box~View~) ViewId
+execute() CommandId
+end_modal(CommandId)
+broadcast(Event, owner)
}
class Window {
-frame: Frame
-interior: Group
-number: Option~u8~
-zoom_rect: Rect
+add(Box~View~) ViewId
+zoom(Rect)
}
class Frame {
-title: String
-resizable: bool
-zoomable: bool
+is_zoomed() bool
}
class Dialog {
-window: Window
-result: CommandId
+execute(Application) CommandId
}
class MenuBar {
-submenus: Vec~SubMenu~
}
class MenuBox
class StatusLine {
-items: Vec~StatusItem~
}
class Button {
-title: String
-command: CommandId
-is_default: bool
}
class InputLine
class StaticText
class Label
class CheckBox
class RadioButton
class ListBox
class ScrollBar
class Scroller
class TextViewer
class Memo
class EditorWindow
class FileEditorWindow
class Event {
+what: EventType
+key_code: u16
+mouse: MouseEvent
+command: CommandId
+clear()
}
class Terminal {
+put_event(Event)
+flush()
}
class Rect
class Palette
Application *-- Desktop
Application *-- Terminal
Application o-- MenuBar
Application o-- StatusLine
Desktop *-- Group
Window *-- Frame
Window *-- Group : interior
Dialog *-- Window
Group o-- "0..*" View : children
Scroller o-- ScrollBar
TextViewer o-- ScrollBar
MenuBar ..> MenuBox : opens
View <|.. Desktop
View <|.. Group
View <|.. Window
View <|.. Frame
View <|.. Dialog
View <|.. MenuBar
View <|.. StatusLine
View <|.. Button
View <|.. InputLine
View <|.. StaticText
View <|.. Label
View <|.. ScrollBar
View <|.. Scroller
View <|.. TextViewer
View <|.. Memo
Cluster <|.. CheckBox
Cluster <|.. RadioButton
ListViewer <|.. ListBox
MenuViewer <|.. MenuBar
MenuViewer <|.. MenuBox
Editor <|.. EditorWindow
FileEditor <|.. FileEditorWindow
View ..> Event : handles
View ..> Terminal : draws to
View ..> Rect : bounds
View ..> Palette : colours from
===============================================================================
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.
dump_screendump_regiondump_to_filescreenshot Feature (on by default): the PNG capture and its embedded 8x16 font; build with --no-default-features --features native to leave it out (F12 dumps and the capture hook still work)