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
raxol lib raxol terminal screen_buffer screen_buffer_state.ex
Raw

lib/raxol/terminal/screen_buffer/screen_buffer_state.ex

defmodule Raxol.Terminal.ScreenBuffer.State do
@moduledoc false
def init do
%{
stack: [],
current: :normal
}
end
def get_stack(state) do
state.stack
end
def update_stack(state, stack) do
%{state | stack: stack}
end
def save(state) do
%{state | stack: [state.current | state.stack]}
end
def restore(state) do
case state.stack do
[current | rest] -> %{state | current: current, stack: rest}
[] -> state
end
end
def has_saved_states?(state) do
length(state.stack) > 0
end
def get_saved_states_count(state) do
length(state.stack)
end
def clear_saved_states(state) do
%{state | stack: []}
end
def get_current(state) do
state.current
end
def update_current(state, new_state) do
%{state | current: new_state}
end
end