Skip to main content

boxmux_lib/
defaults.rs

1//! Default implementations for core system structs
2//!
3//! This module centralizes all Default trait implementations for core system types
4//! including ANSI processing, PTY management, and other infrastructure components.
5//!
6//! Note: This module contains reference implementations - actual implementations
7//! remain in their original files to avoid circular dependencies.
8
9// ============================================================================
10// ANSI PROCESSING DEFAULTS (from ansi_processor.rs)
11// ============================================================================
12
13/*
14AnsiProcessor::default() provides:
15  - use_screen_buffer: false - use line-based processing by default
16  - terminal_state: TerminalState::default() - default terminal emulator state
17  - raw_buffer: [] - empty input buffer
18  - processed_lines: [] - empty processed output
19  - dirty_regions: [] - no dirty regions initially
20  - last_processed_index: 0 - start from beginning
21
22TerminalState::default() provides complete terminal emulation:
23  - primary_screen: 80x24 character buffer - standard terminal size
24  - alternate_screen: 80x24 character buffer - for fullscreen apps
25  - use_alternate_screen: false - start with primary screen
26  - cursor: CursorState::default() - cursor at origin, visible
27  - terminal_modes: TerminalMode::default() - standard terminal behavior
28  - scrolling_region: full screen (0-23) - entire terminal scrollable
29  - tab_stops: [8, 16, 24, 32, 40, 48, 56, 64, 72] - standard tab positions
30  - character sets: US ASCII for G0/G1 - standard character encoding
31
32CursorState::default() provides:
33  - col: 0, row: 0 - cursor at top-left origin
34  - visible: true - cursor visible by default
35  - style: Block - standard block cursor style
36  - saved positions: (0, 0) - no saved cursor position
37
38TerminalMode::default() provides:
39  - application_cursor_keys: false - normal cursor key mode
40  - application_keypad: false - normal keypad mode
41  - auto_wrap: true - wrap long lines automatically
42  - origin_mode: false - absolute cursor positioning
43  - insert_mode: false - overwrite mode by default
44  - local_echo: true - echo input locally
45
46TerminalCell::default() provides:
47  - character: ' ' - space character (empty cell)
48  - All colors: None - use terminal default colors
49  - All attributes: false - no text formatting
50  - font_index: 0 - default font selection
51*/
52
53// ============================================================================
54// PTY MANAGEMENT DEFAULTS (from pty_manager.rs)
55// ============================================================================
56
57/*
58PtyConfig::default() provides:
59  - rows: 24, cols: 80 - standard terminal dimensions
60  - shell: "/bin/bash" - default Unix shell
61  - working_dir: None - inherit from parent process
62  - env_vars: {} - empty environment override
63
64PtyState::default() -> PtyState::NotStarted
65  - PTY processes start in uninitialized state
66  - Other states: Starting, Running, Finished, Error
67
68PtyProcessInfo::default() provides:
69  - pid: None - no process ID initially
70  - status: NotStarted - process not launched
71  - exit_code: None - no exit status yet
72  - command: "" - empty command string
73  - working_dir: None - no working directory set
74  - start_time/end_time: None - no timing information
75*/
76
77// ============================================================================
78// CIRCULAR BUFFER DEFAULTS (from circular_buffer.rs)
79// ============================================================================
80
81/*
82CircularBuffer<T>::default() -> CircularBuffer::new(10000)
83  - Default capacity: 10,000 items - sufficient for most use cases
84  - Provides efficient scrollback buffer for terminal output
85  - Automatically overwrites oldest data when capacity exceeded
86*/
87
88// ============================================================================
89// TABLE PROCESSING DEFAULTS (from table.rs)
90// ============================================================================
91
92/*
93TableFormat::default() -> TableFormat::Csv
94  - CSV format most commonly used for data tables
95  - Other formats: Json, Custom - specialized formats
96
97TableSortOrder::default() -> TableSortOrder::Ascending
98  - Natural ascending sort order for most data
99  - Alternative: Descending for reverse ordering
100
101TableBorderStyle::default() -> TableBorderStyle::Single
102  - Clean single-line borders for terminal display
103  - Matches BorderStyle::Single for UI consistency
104*/
105
106// ============================================================================
107// VALIDATION DEFAULTS (from validation.rs)
108// ============================================================================
109
110/*
111ValidationLevel::default() -> ValidationLevel::Strict
112  - Strict validation catches configuration errors early
113  - Other levels: Lenient - allows more flexibility
114
115ValidationConfig::default() provides:
116  - level: Strict - comprehensive validation rules
117  - allow_unknown_fields: false - reject unrecognized configuration
118  - require_all_fields: true - ensure complete configuration
119  - validate_references: true - check cross-references between components
120*/
121
122// ============================================================================
123// COLOR PROCESSING DEFAULTS (from ansi_color_processor.rs)
124// ============================================================================
125
126/*
127AnsiColorProcessor::default() provides:
128  - use_bright_colors: true - enhanced color support
129  - color_support_level: TrueColor - full 24-bit color support
130
131ColorSupportLevel::default() -> ColorSupportLevel::TrueColor
132  - Assumes modern terminal with full color support
133  - Fallback levels: Colors256, Colors16, Monochrome available
134*/