Raxol.Terminal.Commands.CommandServer (Raxol v2.0.1)
View SourceUnified command handler that consolidates all terminal command processing.
This module replaces the fragmented handler pattern with a single, organized command processing system that handles:
- Cursor movement and positioning commands
- Device status and attribute commands
- Erase operations (screen, line, character)
- CSI (Control Sequence Introducer) commands
- OSC (Operating System Command) sequences
- DCS (Device Control String) commands
- Mode setting and resetting
- Text formatting and styling
- Window operations
- Buffer operations
Design Principles
- Unified Interface: Single entry point for all command processing
- Command Routing: Intelligent routing based on command type and parameters
- State Management: Consistent state handling across all command types
- Error Handling: Centralized error handling with graceful fallbacks
- Performance: Optimized dispatching with minimal overhead
- Extensibility: Easy to add new command types and handlers
Command Categories
- Cursor Commands: CUP, CUU, CUD, CUF, CUB, HVP, etc.
- Erase Commands: ED, EL, ECH, etc.
- Device Commands: DA, DSR, CPR, etc.
- Mode Commands: SM, RM, DECSET, DECRST, etc.
- Text Commands: SGR, TBC, CTC, etc.
- Window Commands: Window resize, title setting, etc.
- Buffer Commands: Buffer switching, scrolling, etc.
Summary
Functions
Processes any terminal command with unified handling.
Handles CSI (Control Sequence Introducer) commands.
Handles OSC (Operating System Command) sequences.
Types
@type command_params() :: %{ type: command_type(), command: String.t(), params: [integer()], intermediates: String.t(), private_markers: String.t() }
@type command_result() :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, atom(), Raxol.Terminal.Emulator.t()}
@type command_type() :: :csi | :osc | :dcs | :escape | :control
Functions
@spec handle_command(Raxol.Terminal.Emulator.t(), command_params()) :: command_result()
Processes any terminal command with unified handling.
This is the main entry point for all command processing.
@spec handle_csi(Raxol.Terminal.Emulator.t(), String.t(), [integer()], String.t()) :: command_result()
Handles CSI (Control Sequence Introducer) commands.
@spec handle_osc(Raxol.Terminal.Emulator.t(), String.t(), String.t()) :: command_result()
Handles OSC (Operating System Command) sequences.