Raxol.Core.Runtime.Events.Converter (Raxol v0.4.0)

View Source

Handles conversion between different event formats in the Raxol system.

This module is responsible for:

  • Converting Termbox events to the Raxol event format
  • Converting VS Code events to the Raxol event format
  • Normalizing events into a consistent format

Summary

Functions

Converts a Termbox event to the standardized Raxol event format.

Converts a VS Code extension event to the standardized Raxol event format.

Normalizes events from various sources into a consistent format.

Functions

convert_termbox_event(type, mod, key, ch, w \\ nil, h \\ nil)

Converts a Termbox event to the standardized Raxol event format.

Parameters

  • type: The Termbox event type (e.g., :key, :resize)
  • mod: Key modifiers (if applicable)
  • key: The key code (for key events)
  • ch: The character (for character events)
  • w, h: Width and height (for resize events)

Returns

A structured %Event{} struct.

convert_vscode_event(event)

Converts a VS Code extension event to the standardized Raxol event format.

Parameters

  • event: The VS Code event map

Returns

A structured %Event{} struct.

normalize_event(event)

Normalizes events from various sources into a consistent format.

This is useful when handling events from multiple backends to ensure they all follow the same structure before processing.

Parameters

  • event: The event to normalize

Returns

A normalized %Event{} struct.