I am happy to announce the release of ratatui_ruby v0.8.0.
This release adds terminal safety features that protect your app and
your users' terminals. It also consolidates bug fixes and quality-of-life
improvements from the v0.7.x series.
What is new:
* **Output Guard.**
`RatatuiRuby.guard_io { }` silences `$stdout` and `$stderr` inside
the block. Chatty gems write to these streams. Their output corrupts
TUI screens. Wrap suspect code in `guard_io` to prevent corruption.
Warns if called outside a session. Silent no-op in headless mode.
* **Headless Mode.**
`RatatuiRuby.headless!` enables batch processing. Use it for CLI apps
with `--no-tui` flags. In headless mode, `guard_io` becomes a silent
no-op. `init_terminal` and `run` raise `Error::Invariant`. The same
code works in both TUI and non-TUI environments.
* **Terminal Safety Hooks.**
`at_exit` and signal handlers for `INT` and `TERM` restore the
terminal automatically. Ctrl+C no longer leaves your terminal in raw
mode. Process termination cleans up properly.
* **Block Inner Area Calculation.**
`Block#inner(area)` computes the usable content area inside a block.
It accounts for borders and padding. Essential for layout calculations.
* **Deferred Warnings.**
Experimental feature warnings now queue during TUI sessions. They
flush to stderr after `restore_terminal`. Warnings no longer corrupt
the TUI display.
* **Session State Tracking.**
`RatatuiRuby.terminal_active?` indicates whether a TUI session is
active. Double-init now raises `Error::Invariant`. Catches state
corruption bugs early.
* **Direct Text Rendering.**
`Text::Line` and `Text::Span` render directly as widgets. No need to
wrap them in a `Paragraph` first.
* **Symbol Shortcuts.**
`Sparkline` and `BarChart` accept `:nine_levels` and `:three_levels`
for bar sets. `Chart` datasets accept `:half_block` for markers.
Intuitive names replace custom character hashes.
* **Edge-Center Legend Positions.**
`Chart` legend now accepts `:top`, `:bottom`, `:left`, and `:right`
alongside corner positions.
* **`:reset` Color.**
`Style` accepts `:reset` for `fg` and `bg`. Explicitly clear inherited
colors.
* **`assert_snapshots` Method.**
New testing helper calls both `assert_plain_snapshot` and
`assert_rich_snapshot`. Generates `.txt` and `.ansi` files in one call.
Breaking changes:
- Double `init_terminal` now raises `Error::Invariant`. Previously
undefined behavior. Call `restore_terminal` first if intentional.
- `assert_snapshot` is deprecated. Use `assert_snapshots` or
`assert_plain_snapshot`.
Bug fixes in this release:
- `Text::Line` alignment is now respected during rendering.
- Styled text objects render correctly in `Tabs`, `Table`, `BarChart`,
`Chart`, and `Block` widgets. Previously showed Ruby inspect strings.
- `Block` title content accepts styled `Text::Line` objects.
Full changelog: https://git.sr.ht/~kerrick/ratatui_ruby/tree/v0.8.0/item/CHANGELOG.md
Gem: https://rubygems.org/gems/ratatui_ruby
Source: https://git.sr.ht/~kerrick/ratatui_ruby