Raxol.Terminal.ScreenBuffer.Manager (Raxol v2.0.1)
View SourceManages buffer lifecycle, memory tracking, damage regions, and buffer switching. Consolidates: Manager, UnifiedManager, SafeManager, EnhancedManager, DamageTracker.
Summary
Functions
Adds a damage region to the active buffer.
Clears the active buffer.
Clears damage regions (stub).
Clears all damage regions from the active buffer.
Constrains a position to buffer bounds (stub).
Gets the currently active buffer.
Gets all damage regions from the active buffer.
Gets memory usage statistics.
Gets current memory usage in bytes.
Gets all metrics.
Gets current cursor position (stub).
Gets total lines in buffer including scrollback (stub).
Gets visible content as string (stub).
Gets visible lines count (stub).
Initializes buffers (stub for test compatibility).
Marks the entire buffer as damaged.
Moves cursor to position (stub).
Creates a new buffer manager with main and alternate buffers.
Reads data from the active buffer (stub for test compatibility).
Increments a clear operation metric.
Increments a scroll operation metric.
Increments a write operation metric.
Resets metrics.
Resets cursor position to origin (stub).
Resizes both buffers.
Starts a GenServer for the manager (stub for test compatibility).
Switches between main and alternate buffers.
Switches to alternate buffer (convenience function).
Switches to main buffer (convenience function).
Toggles between main and alternate buffers.
Trims scrollback if exceeding memory limits.
Updates the active buffer.
Updates memory usage calculation.
Updates cursor position with delta (stub).
Updates visible region for scrolling (stub).
Checks if within memory limits.
Writes data to the active buffer (stub for test compatibility).
Types
@type t() :: %Raxol.Terminal.ScreenBuffer.Manager{ active_buffer_type: :main | :alternate, alternate_buffer: Raxol.Terminal.ScreenBuffer.Core.t(), main_buffer: Raxol.Terminal.ScreenBuffer.Core.t(), memory_limit: non_neg_integer(), memory_usage: non_neg_integer(), metrics: map() }
Functions
@spec add_damage( t(), non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: t()
Adds a damage region to the active buffer.
Clears the active buffer.
Clears damage regions (stub).
Clears all damage regions from the active buffer.
Constrains a position to buffer bounds (stub).
@spec get_active_buffer(t()) :: Raxol.Terminal.ScreenBuffer.Core.t()
Gets the currently active buffer.
Gets all damage regions from the active buffer.
Gets memory usage statistics.
@spec get_memory_usage(t()) :: non_neg_integer()
Gets current memory usage in bytes.
Gets all metrics.
Gets current cursor position (stub).
@spec get_total_lines(t()) :: non_neg_integer()
Gets total lines in buffer including scrollback (stub).
Gets visible content as string (stub).
@spec get_visible_lines(t()) :: non_neg_integer()
Gets visible lines count (stub).
@spec initialize_buffers( non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: t()
Initializes buffers (stub for test compatibility).
Marks the entire buffer as damaged.
Moves cursor to position (stub).
@spec new(non_neg_integer(), non_neg_integer(), keyword()) :: t()
Creates a new buffer manager with main and alternate buffers.
Reads data from the active buffer (stub for test compatibility).
Increments a clear operation metric.
Increments a scroll operation metric.
Increments a write operation metric.
Resets metrics.
Resets cursor position to origin (stub).
@spec resize(t(), non_neg_integer(), non_neg_integer()) :: t()
Resizes both buffers.
Starts a GenServer for the manager (stub for test compatibility).
Switches between main and alternate buffers.
Switches to alternate buffer (convenience function).
Switches to main buffer (convenience function).
Toggles between main and alternate buffers.
Trims scrollback if exceeding memory limits.
@spec update_active_buffer(t(), (Raxol.Terminal.ScreenBuffer.Core.t() -> Raxol.Terminal.ScreenBuffer.Core.t())) :: t()
@spec update_active_buffer(t(), Raxol.Terminal.ScreenBuffer.Core.t()) :: t()
Updates the active buffer.
Can accept either:
- A function that transforms the current buffer
- A new buffer to replace the current one
Updates memory usage calculation.
Updates cursor position with delta (stub).
@spec update_visible_region(t(), non_neg_integer()) :: t()
Updates visible region for scrolling (stub).
Checks if within memory limits.
Writes data to the active buffer (stub for test compatibility).