Overview
The Portix OS console provides a full-featured terminal emulator with command execution, input editing, scrollback history, and a tabbed graphical interface. It operates entirely in graphical mode using the framebuffer driver. Location:~/workspace/source/kernel/src/console/terminal/terminal.rs
Architecture
Terminal Structure
Line Storage
Terminal Line
~/workspace/source/kernel/src/console/terminal/terminal.rs:18
Ring Buffer Implementation
The terminal stores lines in a circular buffer to support unlimited scrollback:Ring Buffer
- Lines 0-71 are overwritten by lines 128-199
oldest_logical()returns 72line_at(72)returns physical slot 72 (oldest preserved line)
~/workspace/source/kernel/src/console/terminal/terminal.rs:89
Input Handling
Character Input
Typing
Command Execution
Command Flow
~/workspace/source/kernel/src/console/terminal/terminal.rs:148
Command System
All commands are implemented in Spanish with English names/aliases:Information Commands
Terminal Commands
Terminal Control
Calculation Commands
Math and Conversion
Demo Commands
Visual Effects
~/workspace/source/kernel/src/console/terminal/terminal.rs:188
Scrolling System
Scroll Controls
Scroll API
- Page Up: Scroll up 10 lines
- Page Down: Scroll down 10 lines
- Home: Jump to oldest line
- End: Jump to newest line
~/workspace/source/kernel/src/console/terminal/terminal.rs:107
Tabbed Interface
The console UI uses a 5-tab layout:Tab Layout
- Active tab:
Color::TAB_ACTIVE(0x0E2240) - Inactive tab:
Color::TAB_INACTIVE(0x030912) - Gold accent bar: 4-pixel strip below header
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:206
Command Examples
System Information
Hardware Inspection
Memory Operations
Calculation
Help System
~/workspace/source/kernel/src/console/terminal/terminal.rs:309
Text Rendering
The console renders text using an 8×8 bitmap font:Text Output
crate::graphics::render::font::FONT_8X8 (96 printable ASCII characters)
Character dimensions: 8×8 pixels, 9-pixel horizontal spacing
Line Editing
Current implementation supports:- Typing: Printable ASCII (32-126)
- Backspace: Delete last character
- Enter: Execute command
- Tab: (reserved for completion)
- Cursor movement (left/right arrows)
- Insert/delete at cursor position
- Command-line editing (Ctrl+A, Ctrl+E, etc.)
- Tab completion
- Up/down arrow history navigation
History
Command History
~/workspace/source/kernel/src/console/terminal/terminal.rs:559
Performance
- Line wrapping: O(1) - splits at 92 columns
- Scrollback: O(1) - ring buffer access
- Rendering: O(n) - n = visible lines (~30)
- Command dispatch: O(1) - hash table lookup
See Also
Graphics
Framebuffer rendering backend
Drivers
Keyboard and mouse input
Filesystem
File commands (future)