feat: rewrite TermUI for 1.0 - #41
Conversation
Replace the process-heavy component system with one Elm runtime and canonical frame boundary. Restore pure widgets, MDEx Markdown, terminal diffs, Zoi schemas, clipboard, Unicode selection, and mouse interaction. Harden terminal input, rendering, resize, error, and shutdown behavior for Jido Console.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f5de9a3ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| defp color(:fg, index, _mode) when is_integer(index), do: ANSI.foreground_256(index) | ||
| defp color(:bg, index, _mode) when is_integer(index), do: ANSI.background_256(index) |
There was a problem hiding this comment.
Convert indexed colors before rendering in 16-color mode
When the TTY backend detects only :color_16 support and a frame contains a public Style using {:indexed, index}, Style.to_cell/2 converts it to an integer and this mode-independent clause emits a 256-color 38;5/48;5 sequence. A terminal limited to 16 colors can ignore or misrender that color, unlike RGB colors which are correctly converted by the later :color_16 clauses; convert indexed colors through the 16-color converter as well.
Useful? React with 👍 / 👎.
| scroll_y = | ||
| if state.follow_end, | ||
| do: max(length(rows) - state.page_size, 0), | ||
| else: min(state.scroll_y, max(length(rows) - 1, 0)) |
There was a problem hiding this comment.
Clamp replacement scroll state to the last page
When set_content/2 shrinks a non-following viewport while its old scroll_y is near the end, this branch permits an offset as high as the last row rather than the last full page. view/2 then silently clamps the displayed offset via geometry/2, but position/1 and emitted scroll messages retain the larger value, so several Up presses can change state without moving the visible content. Clamp against length(rows) - page_size, as the follow_end branch already does.
Useful? React with 👍 / 👎.
|
The v2 work now lives on the native agentjido/term_ui branch next/v2. Clean head: 048ae09. The complete branch CI run passed: https://github.com/agentjido/term_ui/actions/runs/33503327264. This pull request is closed without a merge. Continue v2 work against next/v2. |
Summary
TermUI.Framethe complete render value and give one backend owner control of input, output, size, capabilities, and cleanup.TermUI.Widget.1.0.0-rc.1.Breaking changes
This is a breaking redesign of the published release candidate. It removes the component servers, registries, supervisors, render nodes, duplicate widget namespace, and legacy input and renderer systems. It also defers the SSH backend until it can own a complete terminal session. The migration guide contains the public replacement map.
Verification
mix qualitymix coveralls: 879 tests, 0 failures, 1 excluded, 93.5% total coveragemix test test/term_ui/terminal/raw_mode_pty_test.exs: 1 test, 0 failuresThe raw-mode PTY check confirms that Ctrl+O, Ctrl+C, Ctrl+S, and Ctrl+Q reach the application and that terminal flags are restored.