Raxol.Terminal.Commands.BufferHandlers (Raxol v0.4.0)
View SourceHandles buffer manipulation related CSI commands.
This module contains handlers for buffer operations like insert/delete lines, insert/delete characters, and erase operations. Each function takes the current emulator state and parsed parameters, returning the updated emulator state.
Summary
Functions
Helper function to get active buffer, cursor position, and default style. Returns a tuple of {active_buffer, cursor_pos, default_style}.
Handles Insert Character (ICH - '@')
Handles Insert Line (IL - 'L')
Handles Delete Line (DL - 'M')
Handles Delete Character (DCH - 'P')
Handles Scroll Up (SU - 'S')
Handles Scroll Down (SD - 'T')
Handles Erase Character (ECH - 'X')
Helper function to perform a buffer operation and update the emulator. Takes the emulator, a function that performs the buffer operation, and any additional arguments needed by the operation function.
Functions
@spec get_buffer_state(Raxol.Terminal.Emulator.t()) :: {Raxol.Terminal.ScreenBuffer.t(), {integer(), integer()}, Raxol.Terminal.ANSI.TextFormatting.text_style()}
Helper function to get active buffer, cursor position, and default style. Returns a tuple of {active_buffer, cursor_pos, default_style}.
@spec handle_at(Raxol.Terminal.Emulator.t(), [integer()]) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, atom(), Raxol.Terminal.Emulator.t()}
Handles Insert Character (ICH - '@')
@spec handle_L(Raxol.Terminal.Emulator.t(), [integer()]) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, atom(), Raxol.Terminal.Emulator.t()}
Handles Insert Line (IL - 'L')
@spec handle_M(Raxol.Terminal.Emulator.t(), [integer()]) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, atom(), Raxol.Terminal.Emulator.t()}
Handles Delete Line (DL - 'M')
@spec handle_P(Raxol.Terminal.Emulator.t(), [integer()]) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, atom(), Raxol.Terminal.Emulator.t()}
Handles Delete Character (DCH - 'P')
@spec handle_S(Raxol.Terminal.Emulator.t(), [integer()]) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, atom(), Raxol.Terminal.Emulator.t()}
Handles Scroll Up (SU - 'S')
@spec handle_T(Raxol.Terminal.Emulator.t(), [integer()]) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, atom(), Raxol.Terminal.Emulator.t()}
Handles Scroll Down (SD - 'T')
@spec handle_X(Raxol.Terminal.Emulator.t(), [integer()]) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, atom(), Raxol.Terminal.Emulator.t()}
Handles Erase Character (ECH - 'X')
@spec with_buffer_operation( Raxol.Terminal.Emulator.t(), (Raxol.Terminal.ScreenBuffer.t(), any() -> Raxol.Terminal.ScreenBuffer.t()), any() ) :: Raxol.Terminal.Emulator.t()
Helper function to perform a buffer operation and update the emulator. Takes the emulator, a function that performs the buffer operation, and any additional arguments needed by the operation function.