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/erase_handler.ex
defmodule Raxol.Terminal.Commands.EraseHandler do
@moduledoc """
Handles terminal erase commands like Erase in Display (ED) and Erase in Line (EL).
This module provides simple fallback implementations.
"""
@doc """
Handles erase operations for display, line, or character.
Modes:
- :screen (ED): Erase in Display
- :line (EL): Erase in Line
- :character (ECH): Erase Characters
Parameters:
- mode: 0 = from cursor to end, 1 = from start to cursor, 2 = entire area
- position: {row, col} cursor position
"""
def handle_erase(emulator, scope, mode, position) do
case scope do
:screen ->
# ED - Erase in Display
handle_erase_display(emulator, mode, position)
:line ->
# EL - Erase in Line
handle_erase_line(emulator, mode, position)
:character ->
# ECH - Erase Characters
handle_erase_characters(emulator, mode, position)
_ ->
{:error, :invalid_erase_scope, emulator}
end
end
defp handle_erase_display(emulator, mode, _position) do
# Delegate to CSIHandler's erase display implementation
updated_emulator =
Raxol.Terminal.Commands.CSIHandler.handle_erase_display(emulator, mode)
{:ok, updated_emulator}
end
defp handle_erase_line(emulator, mode, _position) do
# Delegate to CSIHandler's erase line implementation
updated_emulator =
Raxol.Terminal.Commands.CSIHandler.handle_erase_line(emulator, mode)
{:ok, updated_emulator}
end
defp handle_erase_characters(emulator, _count, _position) do
# Simple implementation - erase characters at cursor position
# TODO: Implement actual character erasure in buffer
{:ok, emulator}
end
end