Raxol.Terminal.OutputManager (Raxol v2.0.1)

View Source

Manages terminal output operations including writing, flushing, and output buffering. This module is responsible for handling all output-related operations in the terminal.

Summary

Functions

Clears the output buffer. Returns the updated emulator.

Checks if the output buffer is empty. Returns true if the buffer is empty, false otherwise.

Flushes the output buffer. Returns {:ok, updated_emulator} or {:error, reason}.

Formats ANSI escape sequences for display. Returns the formatted string with ANSI sequences replaced by readable descriptions.

Formats control characters for display. Returns the formatted string.

Formats Unicode characters for display. Returns the formatted string.

Gets the output buffer instance. Returns the output buffer.

Gets the current output buffer content. Returns the buffer content as a string.

Gets the current output buffer encoding. Returns the current encoding.

Gets the current output buffer mode. Returns the current mode.

Gets the output buffer size. Returns the number of bytes in the buffer.

Sets the output buffer content. Returns the updated emulator.

Sets the output buffer encoding. Returns the updated emulator.

Sets the output buffer mode. Returns the updated emulator.

Updates the output buffer instance. Returns the updated emulator.

Writes a string to the output buffer. Returns the updated emulator.

Writes a string to the output buffer with a newline. Returns the updated emulator.

Functions

clear(emulator)

Clears the output buffer. Returns the updated emulator.

empty?(emulator)

@spec empty?(Raxol.Terminal.Emulator.t()) :: boolean()

Checks if the output buffer is empty. Returns true if the buffer is empty, false otherwise.

flush(emulator)

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

Flushes the output buffer. Returns {:ok, updated_emulator} or {:error, reason}.

format_ansi_sequences(string)

@spec format_ansi_sequences(String.t()) :: String.t()

Formats ANSI escape sequences for display. Returns the formatted string with ANSI sequences replaced by readable descriptions.

format_control_chars(string)

@spec format_control_chars(String.t()) :: String.t()

Formats control characters for display. Returns the formatted string.

format_unicode(string)

@spec format_unicode(String.t()) :: String.t()

Formats Unicode characters for display. Returns the formatted string.

get_buffer(emulator)

Gets the output buffer instance. Returns the output buffer.

get_content(emulator)

@spec get_content(Raxol.Terminal.Emulator.t()) :: String.t()

Gets the current output buffer content. Returns the buffer content as a string.

get_encoding(emulator)

@spec get_encoding(Raxol.Terminal.Emulator.t()) :: String.t()

Gets the current output buffer encoding. Returns the current encoding.

get_mode(emulator)

@spec get_mode(Raxol.Terminal.Emulator.t()) :: atom()

Gets the current output buffer mode. Returns the current mode.

get_size(emulator)

Gets the output buffer size. Returns the number of bytes in the buffer.

set_content(emulator, content)

Sets the output buffer content. Returns the updated emulator.

set_encoding(emulator, encoding)

Sets the output buffer encoding. Returns the updated emulator.

set_mode(emulator, mode)

Sets the output buffer mode. Returns the updated emulator.

update_buffer(emulator, buffer)

Updates the output buffer instance. Returns the updated emulator.

write(emulator, string)

Writes a string to the output buffer. Returns the updated emulator.

writeln(emulator, string)

Writes a string to the output buffer with a newline. Returns the updated emulator.