Raxol.Terminal.Emulator.Core (Raxol v2.0.1)

View Source

Handles core emulator functionality including input processing and scrolling.

This module provides core emulator operations including:

  • Input processing
  • Scrolling logic
  • Cursor position management
  • Buffer management

Summary

Functions

Ensures the cursor is in the visible region by scrolling if necessary.

Gets the active buffer from the emulator.

Checks if scrolling is needed and performs it if necessary.

Processes input for the emulator.

Resizes the terminal emulator to new dimensions.

Updates the active buffer in the emulator.

Writes a string to the emulator with charset translation.

Functions

ensure_cursor_in_visible_region(emulator)

Ensures the cursor is in the visible region by scrolling if necessary.

Parameters

  • emulator - The emulator state

Returns

Updated emulator with cursor in visible region.

get_screen_buffer(emulator)

Gets the active buffer from the emulator.

Parameters

  • emulator - The emulator state

Returns

The active screen buffer.

maybe_scroll(emulator)

Checks if scrolling is needed and performs it if necessary.

Parameters

  • emulator - The emulator state

Returns

Updated emulator after scrolling.

process_input(emulator, input)

Processes input for the emulator.

Parameters

  • emulator - The emulator state
  • input - Input to process

Returns

A tuple {updated_emulator, output}.

resize(emulator, width, height)

Resizes the terminal emulator to new dimensions.

Parameters

  • emulator - The emulator state
  • width - New width
  • height - New height

Returns

Updated emulator with new dimensions.

update_active_buffer(emulator, new_buffer)

Updates the active buffer in the emulator.

Parameters

  • emulator - The emulator state
  • new_buffer - The new buffer to set

Returns

Updated emulator with new buffer.

write_string(emulator, x, y, string, style \\ %{})

Writes a string to the emulator with charset translation.

Parameters

  • emulator - The emulator state
  • x - X coordinate
  • y - Y coordinate
  • string - String to write
  • style - Style to apply

Returns

Updated emulator.