Raxol.Terminal.Buffer.UnifiedManager (Raxol v0.5.0)
View SourceUnified buffer management system for the Raxol terminal emulator. This module combines and enhances the functionality of the previous buffer managers, providing improved memory management, caching, and performance metrics.
Summary
Functions
Returns a specification to start this module under a supervisor.
Cleans up the buffer manager.
Clears the active buffer.
Fills a region in the active buffer with a cell.
Gets the active buffer.
Gets the buffer manager state.
Gets a cell from the active buffer at the specified position.
Gets the memory usage of the buffer.
Gets the total number of lines in the buffer.
Gets the visible content of the buffer.
Gets the visible content for a specific buffer.
Gets the number of visible lines in the buffer.
Creates a new unified buffer manager with the specified dimensions.
Resizes the buffer to new dimensions.
Scrolls a region in the active buffer.
Sets a cell in the active buffer at the specified position.
Starts a new buffer manager process.
Updates the buffer with new commands.
Updates the buffer manager configuration. Delegates to update/2 for compatibility.
Updates the visible region of the buffer.
Writes data to the buffer.
Types
@type t() :: %Raxol.Terminal.Buffer.UnifiedManager{ active_buffer: Raxol.Terminal.ScreenBuffer.t(), back_buffer: Raxol.Terminal.ScreenBuffer.t(), height: non_neg_integer(), memory_limit: non_neg_integer(), memory_usage: non_neg_integer(), metrics: map(), scrollback_buffer: Raxol.Terminal.Buffer.Scroll.t(), scrollback_limit: non_neg_integer(), width: non_neg_integer() }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Cleans up the buffer manager.
Clears the active buffer.
Parameters
state
- The buffer manager state
Returns
{:ok, new_state}
- The updated buffer manager state
Fills a region in the active buffer with a cell.
Parameters
state
- The buffer manager statex
- The starting x coordinatey
- The starting y coordinatewidth
- The width of the regionheight
- The height of the regioncell
- The cell to fill the region with
Returns
{:ok, new_state}
- The updated buffer manager state
Gets the active buffer.
Gets the buffer manager state.
Gets a cell from the active buffer at the specified position.
Parameters
state
- The buffer manager statex
- The x coordinatey
- The y coordinate
Returns
{:ok, cell}
- The cell at the specified position
Gets the memory usage of the buffer.
Gets the total number of lines in the buffer.
Gets the visible content of the buffer.
Gets the visible content for a specific buffer.
Gets the number of visible lines in the buffer.
Creates a new unified buffer manager with the specified dimensions.
Parameters
width
- The width of the bufferheight
- The height of the bufferscrollback_limit
- Maximum number of scrollback lines (default: 1000)memory_limit
- Maximum memory usage in bytes (default: 10_000_000)
Returns
{:ok, state}
- The initialized buffer manager state
Resizes the buffer to new dimensions.
Parameters
state
- The buffer manager statewidth
- The new widthheight
- The new height
Returns
{:ok, new_state}
- The updated buffer manager state
Scrolls a region in the active buffer.
Parameters
state
- The buffer manager statex
- The starting x coordinatey
- The starting y coordinatewidth
- The width of the regionheight
- The height of the regionamount
- The number of lines to scroll (positive for down, negative for up)
Returns
{:ok, new_state}
- The updated buffer manager state
Sets a cell in the active buffer at the specified position.
Parameters
state
- The buffer manager statex
- The x coordinatey
- The y coordinatecell
- The cell to set
Returns
{:ok, new_state}
- The updated buffer manager state
Starts a new buffer manager process.
Options
:width
- The width of the buffer (default: 80):height
- The height of the buffer (default: 24):scrollback_limit
- Maximum number of scrollback lines (default: 1000):memory_limit
- Maximum memory usage in bytes (default: 10_000_000)
Returns
{:ok, pid}
- The process ID of the started buffer manager
Updates the buffer with new commands.
Updates the buffer manager configuration. Delegates to update/2 for compatibility.
Updates the visible region of the buffer.
Writes data to the buffer.