Raxol.Terminal.Emulator.Buffer (Raxol v0.3.0)

View Source

Handles screen buffer management for the terminal emulator. Provides functions for buffer operations, scroll region handling, and buffer switching.

Summary

Functions

Clears the active buffer. Returns {:ok, updated_emulator} or {:error, reason}.

Clears the active buffer from cursor to end of screen. Returns {:ok, updated_emulator} or {:error, reason}.

Clears the active buffer from cursor to start of screen. Returns {:ok, updated_emulator} or {:error, reason}.

Clears the current line in the active buffer. Returns {:ok, updated_emulator} or {:error, reason}.

Clears the scroll region, allowing scrolling of the entire screen. Returns {:ok, updated_emulator}.

Scrolls the active buffer down by the specified number of lines. Returns {:ok, updated_emulator} or {:error, reason}.

Scrolls the active buffer up by the specified number of lines. Returns {:ok, updated_emulator} or {:error, reason}.

Sets the scroll region for the active buffer. Returns {:ok, updated_emulator} or {:error, reason}.

Switches between main and alternate screen buffers. Returns {:ok, updated_emulator} or {:error, reason}.

Functions

clear_buffer(emulator)

@spec clear_buffer(Raxol.Terminal.Core.t()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Clears the active buffer. Returns {:ok, updated_emulator} or {:error, reason}.

clear_from_cursor_to_end(emulator)

@spec clear_from_cursor_to_end(Raxol.Terminal.Core.t()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Clears the active buffer from cursor to end of screen. Returns {:ok, updated_emulator} or {:error, reason}.

clear_from_cursor_to_start(emulator)

@spec clear_from_cursor_to_start(Raxol.Terminal.Core.t()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Clears the active buffer from cursor to start of screen. Returns {:ok, updated_emulator} or {:error, reason}.

clear_line(emulator)

@spec clear_line(Raxol.Terminal.Core.t()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Clears the current line in the active buffer. Returns {:ok, updated_emulator} or {:error, reason}.

clear_scroll_region(emulator)

@spec clear_scroll_region(Raxol.Terminal.Core.t()) :: {:ok, Raxol.Terminal.Core.t()}

Clears the scroll region, allowing scrolling of the entire screen. Returns {:ok, updated_emulator}.

scroll_down(emulator, lines)

@spec scroll_down(Raxol.Terminal.Core.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Scrolls the active buffer down by the specified number of lines. Returns {:ok, updated_emulator} or {:error, reason}.

scroll_up(emulator, lines)

@spec scroll_up(Raxol.Terminal.Core.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Scrolls the active buffer up by the specified number of lines. Returns {:ok, updated_emulator} or {:error, reason}.

set_scroll_region(emulator, top, bottom)

@spec set_scroll_region(Raxol.Terminal.Core.t(), non_neg_integer(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Sets the scroll region for the active buffer. Returns {:ok, updated_emulator} or {:error, reason}.

switch_buffer(emulator, invalid_type)

@spec switch_buffer(Raxol.Terminal.Core.t(), :main | :alternate) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Switches between main and alternate screen buffers. Returns {:ok, updated_emulator} or {:error, reason}.