Packages
Multi-surface application runtime for Elixir. One TEA module renders to terminal, browser (LiveView), SSH, and MCP (agents). 30+ widgets, flexbox + CSS grid, AI agent runtime, distributed swarm with CRDTs, time-travel debugging, session recording, sandboxed REPL, and agentic commerce.
Current section
Files
Jump to
Current section
Files
lib/raxol/terminal/commands/csi_handlers/text_handlers.ex
defmodule Raxol.Terminal.Commands.CSIHandlers.TextHandlers do
@moduledoc """
Handlers for text attributes and save/restore cursor CSI commands.
"""
alias Raxol.Terminal.Commands.CSIHandlers.Basic
@doc """
Handles text attributes command.
"""
def handle_text_attributes(emulator, params) do
case Basic.handle_command(
emulator,
params,
?m
) do
{:ok, updated_emulator} -> updated_emulator
{:error, _, _} -> emulator
updated_emulator when is_map(updated_emulator) -> updated_emulator
_ -> emulator
end
end
@doc """
Handles save cursor command.
"""
def handle_save_cursor(emulator, _params) do
# Save cursor position
case Basic.handle_command(
emulator,
[],
?s
) do
{:ok, updated_emulator} -> updated_emulator
{:error, _, _} -> emulator
updated_emulator -> updated_emulator
end
end
@doc """
Handles restore cursor command.
"""
def handle_restore_cursor(emulator, _params) do
# Restore cursor position
case Basic.handle_command(
emulator,
[],
?u
) do
{:ok, updated_emulator} -> updated_emulator
{:error, _, _} -> emulator
updated_emulator -> updated_emulator
end
end
@doc """
Handles save/restore cursor command.
"""
def handle_save_restore_cursor(emulator, params) do
# This function is called for both save (?s) and restore (?u) commands
# We need to determine which command based on the context
# For now, we'll use the Basic handler which should handle both cases
case Basic.handle_command(
emulator,
params,
?s
) do
{:ok, updated_emulator} -> updated_emulator
{:error, _, _} -> emulator
updated_emulator -> updated_emulator
end
end
@doc """
Handles save cursor alias.
"""
def handle_s(emulator, params) do
Basic.handle_command(emulator, params, ?s)
end
@doc """
Handles restore cursor alias.
"""
def handle_u(emulator, params) do
Basic.handle_command(emulator, params, ?u)
end
end