All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
0.7.1 - 2026-04-13
Fixed
- SSH bare Esc key not detected — VTE's state machine swallows
0x1Bas the start of an escape sequence, so a bare Esc press over SSH produced no event. The SSH transport now schedules a 50 ms timeout after a lone0x1Bwith no follow-up bytes; if the timer fires it resets the parser and dispatches a synthetic%Event.Key{code: "esc"}press. Follow-up bytes (the normal case for multi-byte sequences like arrow keys) cancel the timer before it fires. AddedSession.reset_parser/1and its backingsession_reset_parserNIF - Distributed transport crashes on stateful widgets —
TextInputandTextareastore their mutable state in NIF resource references that cannot cross BEAM node boundaries via Erlang distribution. The distributed server now snapshots stateful widget state into plain tuples before sending, and the Rust decoder reconstructs temporary resources from the snapshot on the client node. Stateless widgets are unaffected. Addedtext_input_snapshotandtextarea_snapshotNIFs
0.7.0 - 2026-04-13
Added
- Reducer runtime for
ExRatatui.Appviause ExRatatui.App, runtime: :reducer. Reducer apps implementinit/1,render/2, andupdate/2, receive terminal input as{:event, event}, mailbox messages as{:info, msg}, and can declare subscriptions withsubscriptions/1 ExRatatui.Command— reducer side-effect helpers for immediate messages, delayed messages, async work, and batched command executionExRatatui.Subscription— reducer timer/subscription helpers for interval and one-shot self-messages reconciled by stableidExRatatui.Runtime— runtime inspection helpers exposing snapshots, trace events, and trace enable/disable controls for supervised TUI processesExRatatui.Runtime.inject_event/2— deterministic synthetic event injection for supervised apps undertest_mode- Example:
examples/reducer_counter_app.exs— simple reducer-driven counter showingupdate/2andsubscriptions/1
Changed
ExRatatui.Appnow supports two runtime styles: the existing callback runtime and the new reducer runtime selected withruntime: :reducer- The internal server now supports reducer runtime options for commands, render suppression, trace state, runtime snapshots, async command tracking, and subscription reconciliation
- Render-command encoding moved into
ExRatatui.Bridge, makingExRatatui.draw/2andExRatatui.Session.draw/2share one validation and encoding path - Native render-command decoding was refactored into reusable helpers in
native/ex_ratatui/src/decode.rsand shared between local terminal rendering and session rendering - Bumped
ratatui-textareaRust dependency from 0.8 to 0.9 credodependency restricted to:devenvironment only
Fixed
- New subscriptions now store their timer reference correctly instead of keeping the
{timer_ref, token}tuple in thetimer_reffield, which broke timer cancellation/rearming paths in the reducer runtime - Async command mappers are now wrapped the same way as async functions, so mapper exceptions/exits return structured error tuples and
active_async_commandsbookkeeping is always decremented - The
mount/1callback contract now includes the supported{:ok, state, callback_opts}form, which keeps reducer-style startup shims aligned with Dialyzer and the runtime's actual behavior - Invalid reducer/runtime payloads and malformed render commands now fail earlier with clearer Elixir-side or Rust-side validation errors
- Parallel cold compile crash — the NIF bridge no longer loads its NIF via
@on_loadduring dependency compilation. Precompiled/source artifacts are still prepared at compile time, but the NIF now loads lazily on first use, which stops isolated compiler VMs from crashing under parallel cold compiles on this host test_modeinput flake — local supervised apps and distributed attach clients no longer poll the real terminal while running headless tests, which removes ambient crossterm events from async test runs and stops spurious renders like therender?: falsereducer flake- SSH
auto_host_keybootstrap — host-key generation now recreates the parent<priv_dir>/ssh/directory immediately before writing the key, so first boot succeeds even if the app's priv tree was absent or cleaned between runs
Docs
- Extracted runtime and widget content from README into dedicated guides:
guides/callback_runtime.md,guides/reducer_runtime.md, andguides/building_uis.md - Added widget cheatsheet:
guides/cheatsheets/widgets.cheatmd - README now documents the reducer runtime, reducer example app, command/subscription helpers, and runtime inspection API
- README and
ExRatatui.Appdocs now call out thatmount/1may return runtime opts and thatWidgetList.scroll_offsetis row-based with partial clipping semantics - Expanded public moduledocs for
ExRatatui.App,ExRatatui.Command,ExRatatui.Subscription, andExRatatui.Runtime - HexDocs module grouping now includes reducer-runtime modules
- README now notes that the native library loads lazily on first use
Tests
- Added reducer runtime coverage for commands, subscriptions, tracing, render suppression, async failure handling, and invalid runtime return values
- Added coverage for public
Command,Subscription,Runtime,App, and shared bridge validation paths - Elixir test coverage remains at 100%
0.6.2 - 2026-04-12
Added
- Distribution-attach transport — serve any
ExRatatui.Appto remote BEAM nodes over Erlang distribution. Newtransport: :distributedoption onExRatatui.Appand a standaloneExRatatui.Distributed.Listenerfor direct supervision-tree use. Each attaching node gets its own isolated TUI session; widget lists travel as plain BEAM terms with zero NIF on the app node ExRatatui.Distributed— main API module withattach/3for connecting to a remote TUIExRatatui.Distributed.Listener— supervisor wrapping aDynamicSupervisorfor per-attach sessions, with config stored in:persistent_term- Distributed.Client (internal) — local rendering proxy that takes over the terminal, polls events, and forwards them to the remote server
- Server (internal) learns a
transport: {:distributed_server, client_pid, width, height}init path that sends{:ex_ratatui_draw, widgets}over distribution instead of rendering locally - Guide:
guides/distributed_transport.md— architecture, quick start, options reference, testing, troubleshooting - README "Running over Erlang Distribution" section
examples/system_monitor.exsnow supports--distributedflag for running over Erlang distribution:peer-based integration tests for the full cross-node roundtrip (tagged:distributed, run withelixir --sname test -S mix test --only distributed)
Changed
test_modenow means fully headless local runtime behaviour: it disables live terminal input polling on both the server andDistributed.Client, and runtime snapshots expose whether polling is enabledServer event and resize handlers are now shared between
:sshand:distributed_servertransportsExRatatui.Appdispatch_start/1routes:distributedtoExRatatui.Distributed.Listener.start_link/1WidgetListscroll_offsetis now row-based — previouslyscroll_offsetskipped whole items by index; it now skips rows of content. To scroll to a specific item, sum the heights of all preceding items. Items partially above the viewport are clipped at the row level, enabling smooth pixel-row scrolling for chat histories and similar variable-height lists. This is a breaking change for callers that relied on the item-index interpretationMigration: If you set
scroll_offsetto an item index (e.g.,scroll_offset: selected), replace it with the cumulative row height of preceding items. For example, if all items have height 3:scroll_offset: selected * 3. For variable-height items, sum their heights:scroll_offset: items |> Enum.take(selected) |> Enum.map(&elem(&1, 1)) |> Enum.sum()
Fixed
WidgetListpartial-item clipping — items straddling the top edge of the viewport are now correctly rendered via an off-screen buffer blit instead of being skipped entirely
0.6.1 - 2026-04-09
Fixed
- SSH subsystem dispatch —
ssh host -s Elixir.MyApp.TUI(andExRatatui.SSH.subsystem/1undernerves_ssh) would hang forever instead of rendering. The channel handler was waiting for a{:ssh_cm, _, {:subsystem, ...}}message insidehandle_ssh_msg/2, but OTP:sshconsumes that request internally when it matches a name in the daemon's:subsystemsconfig — the handler only ever receives{:ssh_channel_up, ...}.ExRatatui.SSHnow detects subsystem-mode dispatch (via a newsubsystem: trueflag baked into the init args bysubsystem/1andExRatatui.SSH.Daemon) and synthesizes a default 80x24 session + starts the TUI server directly from{:ssh_channel_up, ...}. Shell-mode startup (viassh_cli) is unchanged — it still waits forpty_req+shell_reqas before - SSH subsystem +
-tpty_req races — when a client connects withssh -t -s Elixir.MyApp.TUI, OTP firesssh_channel_upfirst (we start an 80x24 session + server) and then delivers the client'spty_reqwith the real dimensions. The previouspty_reqhandler created a brand-newSessionon every call, which left the SSH channel pointing at a session the running Server no longer rendered into. The handler now splits onsession: nilvssession: %Session{}and resizes the existing session in place when one is already there, mirroring thewindow_changepath - SSH subsystem pty-size discovery on nerves_ssh — even with the pty_req race fixed, a subsystem TUI riding on
nerves_ssh(or any:ssh.daemonthat configures a default CLI handler) would stay stuck at the hardcoded 80x24 fallback instead of filling the client's real terminal. Root cause: OTP'sssh_connection:handle_cli_msg/3hands pty_req to the daemon's default CLI handler when the channel's user pid is stillundefined, and then silently orphans that CLI handler the moment the subsequent subsystem request rebinds the pid to us — so the subsystem handler never sees pty_req on those deployments, no matter how early it arrives.ExRatatui.SSHnow sidesteps the whole OTP path by emitting a Cursor Position Report roundtrip (ESC[s ESC[9999;9999H ESC[6n ESC[u) on{:ssh_channel_up, ...}: the client clamps the bogus cursor position to its real pty size, responds withESC[<row>;<col>R, the session's ANSI input parser decodes that as a%ExRatatui.Event.Resize{}, and the{:data, ...}handler resizes the session in place + notifies the running server via{:ex_ratatui_resize, w, h}. Shell-mode startup is unaffected — it still reads the dimensions straight offpty_req session_input.rsCPR parsing — the VTE-driven input parser now recognizesESC[<row>;<col>RCursor Position Report responses and emits them asNifEvent::Resize(col, row)so the SSH transport's CPR-based pty-size discovery has something to intercept. The handler runs before the simple-CSI dispatch that would otherwise silently drop anyRfinal byte- SSH subsystem startup — added a shell-vs-subsystem section to
ExRatatui.SSH's moduledoc and theguides/ssh_transport.mdguide explaining which message triggers server boot in each mode, plus a loud "always pass-t" caveat (OpenSSH doesn't allocate a PTY for subsystem invocations by default, which leaves the client's local terminal in cooked mode — keystrokes get line-buffered and echoed locally on top of the TUI)
0.6.0 - 2026-04-09
Added
- SSH transport — serve any
ExRatatui.Appto remote clients over OTP:ssh. Newtransport: :sshoption onExRatatui.Appand a standaloneExRatatui.SSH.Daemonfor direct supervision-tree use. Each connected client gets its own isolated TUI session; works as a primary daemon or as anerves_sshsubsystem viaExRatatui.SSH.subsystem/1 ExRatatui.Session— in-memory transport-agnostic terminal session (RustSharedWriter+Viewport::Fixed) withnew/2,draw/2,take_output/1,feed_input/2,resize/3,size/1, andclose/1ExRatatui.SSH—:ssh_server_channelimplementation that drives a Session per channel, parses ANSI input viavte, and handles PTY negotiation,window_change, and alt-screen lifecycleExRatatui.SSH.Daemon— GenServer wrapping:ssh.daemon/2withport/1anddaemon_ref/1introspection helpersExRatatui.SSH.Daemon:auto_host_keyoption — when set, the daemon resolves the OTP application that owns:mod, ensures<priv_dir>/ssh/exists, and generates a 2048-bit RSA host key on first boot. Subsequent boots reuse the same key. Lets Phoenix admin TUIs and similar drop the daemon straight into a supervision tree without hand-rolling host-key bootstrapExRatatui.SSH.Daemon:system_diraccepts binary paths in addition to charlists; the daemon converts them before forwarding to:ssh.daemon/2- VTE-based input parser covering arrows, function keys, SS3, CSI modifiers, Alt+letter, Ctrl+letter, and partial-sequence buffering across feeds (SSH delivers byte-at-a-time during interactive use)
- 7 new session NIFs on ExRatatui.Native:
session_new/2,session_close/1,session_draw/2,session_take_output/1,session_feed_input/2,session_resize/3,session_size/1 - Guide:
guides/ssh_transport.md— architecture, quick start,nerves_sshintegration, options reference, host-key generation, troubleshooting - Examples ship an SSH mode:
examples/system_monitor.exs --sshandexamples/task_managerviaTASK_MANAGER_SSH=1(multiple clients share one SQLite database) - README "Running Over SSH" section
- CI enforces 100% Elixir test coverage threshold (NIF modules excluded)
- Missing doctests for
ExRatatui,Event,Event.Key,Event.Mouse,Event.Resize, andSlashCommands - Callback documentation for all
ExRatatui.Appcallbacks
Changed
ExRatatui.Server learns a
transport: :local | :sshoption and an alternateinit/1path that drives an injected Session + writer function instead of the local terminalExRatatui.Appgains a:transportoption that dispatches between ExRatatui.Serverstart_link/1andExRatatui.SSH.Daemon.start_link/1
Docs
- Expanded moduledoc prose for
ExRatatui,Event, and event struct modules - Added coverage requirement note to CONTRIBUTING.md
Tests
- Bumped Elixir test coverage to 100% — added server, rendering, layout, event, and widget tests
- End-to-end SSH integration test exercising
:ssh.daemon/2+:ssh.connect/3round trip with a generated host key (mount → render bytes → keystroke roundtrip → window_change)
0.5.1 - 2026-03-25
Added
ExRatatui.Widgets.Markdown— markdown rendering widget with syntax-highlighted code blocks, powered bytui-markdown(pulldown-cmark + syntect)ExRatatui.Widgets.Textarea— multiline text editor with undo/redo, cursor movement, and Emacs-style shortcuts. Second stateful widget — state lives in Rust via ResourceArcExRatatui.Widgets.Throbber— loading spinner widget with 12 animation sets (braille, dots, ascii, arrow, clock, and more)ExRatatui.Widgets.Popup— centered modal overlay widget for dialogs, confirmations, and command palettesExRatatui.Widgets.WidgetList— vertical list of heterogeneous widgets with selection and scrolling, ideal for chat message historiesExRatatui.Widgets.SlashCommands— slash command parsing, matching, and autocomplete popup rendering- Textarea NIF functions:
textarea_new/0,textarea_handle_key/3,textarea_get_value/1,textarea_set_value/2,textarea_cursor/1,textarea_line_count/1 - Example:
chat_interface.exs— AI chat interface demonstrating Markdown, Textarea, Throbber, Popup, WidgetList, and SlashCommands
Fixed
- Replaced deprecated
Padding::zero()withPadding::ZEROin Rust widget renderers - Wired up unused
stylefield inWidgetListrender function (was#[allow(dead_code)]) - Fixed flaky Rust throbber step test —
calc_step(0)uses random index, now tests with deterministic non-zero steps - Throbber animation set test now covers all 12 sets (was 7)
0.5.0 - 2026-03-22
Added
ExRatatui.Widgets.Tabs— a tab bar widget for switching between views, with customizable selection highlight, divider, and paddingExRatatui.Widgets.Scrollbar— a scrollbar widget for indicating scroll position, supporting all four orientations (vertical right/left, horizontal bottom/top)ExRatatui.Widgets.LineGauge— a thin single-line progress bar using line-drawing characters, with separate filled/unfilled stylesExRatatui.Widgets.Checkbox— a checkbox widget for boolean toggles, with customizable checked/unchecked symbols and stylesExRatatui.Widgets.TextInput— a single-line text input widget with cursor navigation, viewport scrolling, and placeholder support. First stateful widget — state lives in Rust via ResourceArc- Example:
widget_showcase.exs— interactive demo with tabs, progress bars, checkboxes, text input, scrollable logs, and scrollbar (replaces individualtabs_demo.exs,scrollbar_demo.exs,line_gauge_demo.exs) - Doctests for
Tabs,Scrollbar,LineGauge, andCheckboxstruct modules - Updated
task_manager.exsexample to useTabs(header),LineGauge(progress),Scrollbar(task table), andTextInput(new task creation — replaces hand-rolled input buffer with proper cursor navigation, viewport scrolling, and placeholder support) - Updated
examples/task_manager/App to useTabs(filter bar with Tab/Shift+Tab navigation),LineGauge(replacesGauge),Scrollbar(task table), andTextInput(replaces hand-rolled input buffer) - Comprehensive
TextInputstate management tests: get/set value, cursor positioning, backspace, delete, left/right, home/end, and mid-text insertion
Fixed
Checkboxmoduledoc now correctly states that:checked_symboland:unchecked_symboldefault tonil(rendered as"[x]"/"[ ]"by the Rust backend)- Removed redundant
.padding()call in Rust tabs renderer that was always overwritten
0.4.2 - 2026-03-06
Added
ExRatatui.Widgets.Clear— a widget that resets all cells in its area to empty (space) characters, useful for rendering overlays
Fixed
- Put back
Elixir.prefix fromListcalls intask_manager.exsexample
0.4.1 - 2026-02-23
Fixed
init_terminalNIF now cleans up raw mode and alternate screen on partial initialization failure- All I/O-bound NIFs (
init_terminal,restore_terminal,draw_frame,terminal_size) now run on the DirtyIo scheduler to avoid blocking normal BEAM schedulers App.render/2callback typespec narrowed fromterm()toExRatatui.widget()for proper Dialyzer coverageConstraint::Ratiowith denominator zero now returns an error instead of panickingGaugeratio now validates the value is finite, preventing a panic on NaN inputApp.mount/1callback typespec now includes{:error, reason}returnExRatatui.run/1afterblock no longer masks the original exception if terminal restore also fails- Server render errors now log the full stacktrace for easier debugging
- Added missing
@impl trueon fallbackterminate/2clause in the server ExRatatui.Framestruct defaults towidth: 0, height: 0instead ofnil(typespec now matches actual usage)- Deduplicated
encode_constraint/1—ExRatatui.Layoutis now the single source of truth - Fixed flaky
poll_eventtests that failed when terminal events arrived during the test run Event.Mousetypespec fields are now non-nullable to match actual NIF output- Fixed
system_monitor.exsto cache hostname between refreshes withMap.get_lazy/3 - Removed unnecessary
Elixir.prefix fromListcalls intask_manager.exsexample - Added server tests for
{:stop, state}fromhandle_info/2andterminate/2callback
Docs
- HexDocs "View Source" links now point to the correct version tag
- Expanded
ExRatatuimoduledoc with quick start, core API overview, and cross-references - README demo GIF now uses an absolute URL so it renders on Hex.pm
- README modifiers list now shows all six supported modifiers
- Documented
:test_modeoption inExRatatui.Appfor headless testing - Clarified
system_monitor.exsis Linux/Nerves only in README
0.4.0 - 2026-02-23
Changed
- BREAKING: Terminal state is now per-process via Rust ResourceArc instead of a global mutex
ExRatatui.run/1closure now receives the terminal reference (1-arity)draw/1is nowExRatatui.draw/2(terminal reference as first argument)ExRatatui.init_test_terminal/2returns a terminal reference instead of:okget_buffer_content/0is nowExRatatui.get_buffer_content/1ExRatatui.Appbehaviour users: no API changes
- Terminal is automatically restored when the terminal reference is garbage collected (crash safety)
- Test terminal instances are now independent, enabling
async: truefor rendering tests
Added
- Comprehensive API documentation: all key codes, mouse events, colors, modifiers, and App options
- Doctests for Layout, Style, Frame, all widgets, and test backend
- CONTRIBUTING.md with development setup
0.3.0 - 2026-02-23
Added
- Typespecs (
@type t) for all widget, event, and frame structs - Function specs (
@spec) for all public API functions - Dialyzer static analysis in CI
Changed
- Extracted
Event.Key,Event.Mouse,Event.ResizeandLayout.Rectinto their own files
Fixed
- Server
start_link/1now supportsname: nilto start without process registration - App-based TUI processes hanging on macOS — the event poll loop now delegates the timeout to the NIF on the DirtyIo scheduler instead of using
Process.send_after/3, which was causing the GenServer to stop processing messages
0.2.0 - 2026-02-21
Changed
- Simplified release workflow by using
rustler-precompiled-actioninstead of manual build and packaging steps
Added
- Precompiled NIF target for
riscv64gc-unknown-linux-gnu(Nerves RISC-V boards) - System monitor example (
examples/system_monitor.exs) for running on Nerves devices via SSH
0.1.1 - 2026-02-19
Changed
- Improved HexDocs module grouping: Frame moved under Layout, App under new Application group
- Added demo GIF to README
Fixed
- Changelog formatting for ex_doc compatibility
0.1.0 - 2026-02-19
Added
- Widgets: Paragraph (with alignment, wrapping, scrolling), Block (borders, titles, padding), List (selectable with highlight), Table (headers, rows, column constraints), and Gauge (progress bar)
- Layout engine: Constraint-based area splitting via
ExRatatui.Layout.split/3with support for:percentage,:length,:min,:max, and:ratioconstraints - Event polling: Non-blocking keyboard, mouse, and resize event handling on BEAM's DirtyIo scheduler
- Styling system: Named colors, RGB (
{:rgb, r, g, b}), 256-color indexed ({:indexed, n}), and text modifiers (bold, italic, underlined, dim, crossed out, etc.) - Terminal lifecycle:
ExRatatui.run/1for automatic terminal init and cleanup - OTP App behaviour:
ExRatatui.Appwith LiveView-inspired callbacks (mount/1,render/2,handle_event/2,handle_info/2) for building supervised TUI applications - GenServer runtime: manages terminal lifecycle, self-scheduling event polling, and callback dispatch under OTP supervision
- Frame struct:
ExRatatui.Framecarries terminal dimensions torender/2callbacks - Test backend: Headless
TestBackendviainit_test_terminal/2andget_buffer_content/0for CI-friendly rendering verification - Precompiled NIFs: Via
rustler_precompiledfor Linux, macOS, and Windows (x86_64 and aarch64) — no Rust toolchain required - Examples:
hello_world.exs(minimal display),counter.exs(interactive key events),counter_app.exs(App-based counter),task_manager.exs(full app with all widgets), andexamples/task_manager/(supervised Ecto + SQLite CRUD app)