Raxol.Terminal.Integration (Raxol v0.2.0)
View SourceIntegrates various terminal components like Emulator, Buffer Manager, Cursor Manager, etc.
This module acts as a central orchestrator, managing interactions between:
- Terminal Emulator state (
Raxol.Terminal.Emulator
) - Screen buffer management (
Raxol.Terminal.Buffer.Manager
) - Cursor state and rendering (
Raxol.Terminal.Cursor.Manager
) - Scrollback buffer (
Raxol.Terminal.Buffer.Scroll
) - Input handling and command history (
Raxol.Terminal.Commands.History
) - Terminal configuration (
Raxol.Terminal.Config
) - Managing memory and performance optimizations
- Command history management
Summary
Functions
Clears the damage regions in the buffer manager.
Clears the screen with integrated buffer management.
Clears the scroll buffer with integrated scroll buffer management.
Executes a command and updates the command history.
Gets the current cursor position with integrated cursor management.
Gets the current cursor state with integrated cursor management.
Gets the current cursor style with integrated cursor management.
Gets the damage regions from the buffer manager.
Gets the total scroll height with integrated scroll buffer management.
Gets the current scroll position with integrated scroll buffer management.
Gets a view of the scroll buffer with integrated scroll buffer management.
Gets the visible content of the terminal with integrated buffer management.
Handles a device status query.
Handles input from the user, including command history navigation.
Hides the cursor with integrated cursor management.
Invokes a character set.
Moves the cursor to the specified position with integrated cursor management.
Creates a new integrated terminal system with the specified dimensions.
Resets a specific screen mode in the emulator.
Restores the previously saved cursor position with integrated cursor management.
Saves the current cursor position with integrated cursor management.
Checks if a screen mode is enabled.
Scrolls the terminal content with integrated scroll buffer management.
Sets a character set for a G-set.
Sets the cursor blink rate with integrated cursor management.
Sets the cursor style with integrated cursor management.
Sets a specific screen mode in the emulator.
Shows the cursor with integrated cursor management.
Switches the active and back buffers in the buffer manager.
Switches to the alternate screen buffer.
Switches back to the main screen buffer.
Updates the terminal configuration.
Updates the cursor blink state with integrated cursor management.
Updates memory usage tracking in the buffer manager.
Checks if memory usage is within limits.
Writes text to the terminal with integrated buffer and cursor management.
Types
@type t() :: %Raxol.Terminal.Integration{ buffer_manager: Raxol.Terminal.Buffer.Manager.t(), command_history: Raxol.Terminal.Commands.History.t(), config: map(), cursor_manager: Raxol.Terminal.Cursor.Manager.t(), emulator: Raxol.Terminal.Emulator.t(), last_cleanup: integer(), renderer: Raxol.Terminal.Renderer.t(), scroll_buffer: Raxol.Terminal.Buffer.Scroll.t() }
Functions
Clears the damage regions in the buffer manager.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Hello")
iex> integration = Integration.clear_damage_regions(integration)
iex> Integration.get_damage_regions(integration)
[]
Clears the screen with integrated buffer management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Hello")
iex> integration = Integration.clear_screen(integration)
iex> Integration.get_visible_content(integration)
""
Clears the scroll buffer with integrated scroll buffer management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Line 1
Line 2 Line 3")
iex> integration = Integration.clear_scroll_buffer(integration)
iex> Integration.get_scroll_height(integration)
0
Executes a command and updates the command history.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.execute_command(integration, "ls -la")
Gets the current cursor position with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.move_cursor(integration, 10, 5)
iex> Integration.get_cursor_position(integration)
{10, 5}
Gets the current cursor state with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.hide_cursor(integration)
iex> Integration.get_cursor_state(integration)
:hidden
Gets the current cursor style with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.set_cursor_style(integration, :underline)
iex> Integration.get_cursor_style(integration)
:underline
Gets the damage regions from the buffer manager.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Hello")
iex> regions = Integration.get_damage_regions(integration)
iex> length(regions)
1
Gets the total scroll height with integrated scroll buffer management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Line 1
Line 2 Line 3")
iex> Integration.get_scroll_height(integration)
3
Gets the current scroll position with integrated scroll buffer management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.scroll(integration, 5)
iex> Integration.get_scroll_position(integration)
5
Gets a view of the scroll buffer with integrated scroll buffer management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Line 1
Line 2 Line 3")
iex> view = Integration.get_scroll_view(integration, 2)
iex> length(view)
2
Gets the visible content of the terminal with integrated buffer management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Hello")
iex> Integration.get_visible_content(integration)
"Hello"
Handles a device status query.
Examples
iex> integration = Integration.new(80, 24)
iex> response = Integration.handle_device_status_query(integration, "6")
iex> response
"[1;1R"
Handles input from the user, including command history navigation.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.handle_input(integration, "ls -la")
iex> integration = Integration.handle_input(integration, :up_arrow)
Hides the cursor with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.hide_cursor(integration)
iex> integration.cursor_manager.state
:hidden
Invokes a character set.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.invoke_character_set(integration, "0")
Moves the cursor to the specified position with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.move_cursor(integration, 10, 5)
iex> integration.cursor_manager.position
{10, 5}
Creates a new integrated terminal system with the specified dimensions.
Examples
iex> integration = Integration.new(80, 24)
iex> integration.emulator.width
80
iex> integration.emulator.height
24
Resets a specific screen mode in the emulator.
Restores the previously saved cursor position with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.move_cursor(integration, 10, 5)
iex> integration = Integration.save_cursor(integration)
iex> integration = Integration.move_cursor(integration, 0, 0)
iex> integration = Integration.restore_cursor(integration)
iex> integration.cursor_manager.position
{10, 5}
Saves the current cursor position with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.move_cursor(integration, 10, 5)
iex> integration = Integration.save_cursor(integration)
iex> integration.cursor_manager.saved_position
{10, 5}
Checks if a screen mode is enabled.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.screen_mode_enabled?(integration, :alternate_screen)
false
Scrolls the terminal content with integrated scroll buffer management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Line 1
Line 2 Line 3")
iex> integration = Integration.scroll(integration, 1)
iex> Integration.get_visible_content(integration)
"Line 2
Line 3"
Sets a character set for a G-set.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.set_character_set(integration, "0", "B")
Sets the cursor blink rate with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.set_cursor_blink_rate(integration, 1000)
iex> integration.cursor_manager.blink_rate
1000
Sets the cursor style with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.set_cursor_style(integration, :underline)
iex> integration.cursor_manager.style
:underline
Sets a specific screen mode in the emulator.
Shows the cursor with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.hide_cursor(integration)
iex> integration = Integration.show_cursor(integration)
iex> integration.cursor_manager.state
:visible
Switches the active and back buffers in the buffer manager.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Hello")
iex> integration = Integration.switch_buffers(integration)
iex> integration.buffer_manager.active_buffer != integration.buffer_manager.back_buffer
true
Switches to the alternate screen buffer.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.switch_to_alternate_buffer(integration)
Switches back to the main screen buffer.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.switch_to_main_buffer(integration)
Updates the terminal configuration.
Merges the provided opts
into the current configuration and validates
the result before applying.
Examples
iex> integration = Integration.new(80, 24)
iex> {:ok, integration} = Integration.update_config(integration, theme: "light", behavior: [scrollback_lines: 2000])
iex> integration.config.theme
"light"
iex> integration.config.behavior.scrollback_lines
2000
iex> {:error, _reason} = Integration.update_config(integration, invalid_opt: :bad)
Updates the cursor blink state with integrated cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.set_cursor_style(integration, :blinking)
iex> {integration, visible} = Integration.update_cursor_blink(integration)
iex> is_boolean(visible)
true
Updates memory usage tracking in the buffer manager.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.update_memory_usage(integration)
iex> integration.buffer_manager.memory_usage > 0
true
Checks if memory usage is within limits.
Examples
iex> integration = Integration.new(80, 24)
iex> Integration.within_memory_limits?(integration)
true
Writes text to the terminal with integrated buffer and cursor management.
Examples
iex> integration = Integration.new(80, 24)
iex> integration = Integration.write(integration, "Hello")
iex> Integration.get_visible_content(integration)
"Hello"