Changelog
All notable changes to this project will be documented in this file. The format is based on Keep a Changelog. This project adheres to Semantic Versioning.
Unreleased
Added
Changed
Fixed
Removed
0.5.0 - 2026-01-01
Added
Frame API
-
RatatuiRuby.draw { |frame| ... }: New block-based drawing API that yields aFrameobject for explicit widget placement. Enables hit testing without duplicating layout calculations. -
Frame#area: Returns the terminal area as aRect. -
Frame#render_widget(widget, rect): Renders a widget at a specific position. Works with all existing widgets andRectobjects.
Testing
-
RatatuiRuby::TestHelper#inject_mouse: comprehensive mouse event injection helper supporting coordinates, buttons, and modifiers. -
RatatuiRuby::TestHelper#inject_click: Helper for left-click events. -
RatatuiRuby::TestHelper#inject_right_click: Helper for right-click events. -
RatatuiRuby::TestHelper#inject_drag: Helper for mouse drag events. -
RatatuiRuby::TestHelper#assert_screen_matches: Assert that the current terminal content matches a stored golden snapshot.
Session API
-
Convenience Methods:
Sessionnow wraps class methods fromLayout,Constraint, and other schema classes as instance methods (e.g.,layout_splitdelegates toLayout.split,constraint_percentagetoConstraint.percentage). This enables a more fluent API inRatatuiRuby.runblocks.
Changed
Event System
-
Event::None(Breaking):RatatuiRuby.poll_eventnow returnsEvent::Noneinstead ofnilwhen no event is available. This null-object responds safely to all event predicates withfalse. Useevent.none?or pattern-match ontype: :none. Code usingwhile (event = poll_event)must change towhile (event = poll_event) && !event.none?.
Fixed
Session API
-
Missing Convenience Methods: Fixed
Sessionconvenience methods (e.g., bar_chart) being missed by replacing the manual list with automatic runtime introspection of theRatatuiRubymodule.
Removed
0.4.0 - 2025-12-30
Added
Hex Color Support
-
Style:
fgandbgparameters now accept hex color strings (e.g.,"#ff0000"for red). Requires a 24-bit true color capable terminal (Kitty, iTerm2, modern Terminal.app). Terminals without true color support will gracefully fall back to the closest ANSI color.
RatatuiMascot Widget
-
RatatuiMascot: New widget to display the Ratatui mascot (Ferris).
RatatuiLogo Widget
-
RatatuiLogo: New widget to display the Ratatui logo.
Duck-Typed Numeric Coercion
-
All numeric parameters now accept any object that responds to
to_f(for floats) orto_int/to_i(for integers). This provides idiomatic Ruby interoperability withBigDecimal,Rational, and custom numeric types. Uses Rubyās built-inFloat()andInteger()Kernel methods for proper duck-type handling.
Paragraph Widget
-
alignment: Breaking Change: Renamedaligntoalignmentto match Ratatui 0.30 API.
Custom Widgets
-
Draw Command API: Custom widgets now return an array of
Drawcommands instead of writing to a buffer. UseRatatuiRuby::Draw.string(x, y, string, style)andRatatuiRuby::Draw.cell(x, y, cell)to create draw commands. This eliminates use-after-free bugs by keeping all pointers inside Rust while Ruby works with pure data objects. Breaking: Therendermethod signature changed fromrender(area, buffer)torender(area).
BarChart Widget
-
bar_set: Customize bar characters (digits, symbols, blocks). -
group_gap: Control spacing between groups in grouped bar charts. -
data: Now accepts an Array ofBarGroupobjects, enabling grouped bar charts. -
BarandBarGroup: New schema classes for defining grouped bar data.
Block Widget
-
border_type: Customize border style (:plain,:rounded,:double,:thick,:quadrant_inside,:quadrant_outside). -
border_set: Customize border characters (e.g., digits, symbols). -
border_style: Apply full style support (colors and modifiers) to borders. Takes precedence overborder_color. -
children: Declare child widgets within the blockās area for composable UI structures. -
Multiple
titles: Display multiple titles with individual alignment (:left,:center,:right) and vertical positioning (:top,:bottom). Each title supports its ownstyle. -
title_style: Base style applied to all titles. -
style: Base style applied to the entire block. -
padding: Directional padding via a single integer (uniform) or array of 4 integers ([left, right, top, bottom]). -
line_count(width): (Experimental) Calculate rendered lines (including borders/padding) for a given width. Delegates to Ratatuiās underlying unstableline_count. -
line_width: (Experimental) Calculate minimum width to avoid wrapping (including borders/padding). Delegates to Ratatuiās underlying unstableline_width.
Calendar Widget
-
events: Hash mappingDateobjects toStyleobjects for highlighting specific dates. -
show_month_header: Toggle month header visibility (defaults tofalse). Breaking: Previously always shown. -
show_weekdays_header: Toggle weekday names (Mon, Tue, etc.) visibility (defaults totrue). -
show_surrounding: OptionalStyleto display dates from adjacent months, ornilto hide them.
Chart Widget
-
legend_position: Position legend at:top_left,:top_right,:bottom_left, or:bottom_right(defaults to:top_right). -
hidden_legend_constraints: Array of twoConstraintobjects to hide the legend when chart area is too small. -
Axis:
labels_alignmentto control horizontal alignment (:left,:center,:right) of axis labels. -
Dataset:styleparameter replacescolor, enabling full styling (fg, bg, modifiers) for chart datasets. Breaking:colorparameter removed.
Gauge Widget
-
style: Base style applied to the entire gauge background. -
gauge_style: Style applied specifically to the filled bar. Breaking: Use this instead ofstyleif you want bar coloring;styleno longer defaults toStyle.default. -
percent: Convenience parameter alternative toratiofor initialization. -
use_unicode: Explicitly toggle between unicode blocks and ASCII rendering (defaults totrue).
LineGauge Widget
-
style: Base style applied to the entire gauge area.
List Widget
-
scroll_padding: Number of items to keep visible above and below the selected item during scrolling. -
repeat_highlight_symbol: Whentrue, repeat highlight symbol on each line of multi-line selections. -
highlight_spacing: Control selection column reservation (:always,:when_selected,:never). -
direction: List orientation (:top_to_bottomor:bottom_to_top).
Sparkline Widget
-
absent_value_symbolandabsent_value_style: Customize rendering ofnilvalues (distinct from0). -
direction: Rendering direction (:left_to_rightor:right_to_left). -
bar_set: Customize bar characters.
Table Widget
-
style: Base style applied to the entire table. -
column_spacing: Horizontal spacing between columns. -
footer: Summary rows at the bottom of the table. -
flex: Layout distribution mode (:legacy,:start,:center,:end,:space_between,:space_around,:space_evenly). -
highlight_spacing: Control selection column reservation (:always,:when_selected,:never). -
column_highlight_style: Style applied to the selected column. -
cell_highlight_style: Style applied to the selected cell (intersection of row and column). -
selected_column: Index of the selected column (Integer or nil). -
widths: Now support all constraint types (:max,:fill,:ratio) with full flexibility.
Tabs Widget
-
style: Base style applied to the entire tabs area. -
padding_leftandpadding_right: Horizontal padding around tab titles. -
width: Calculate total width of the tabs (including dividers/padding).
Canvas Widget
-
background_color: Set canvas background color. -
:half_blockmarker: Block-based rendering using half-height blocks. -
:quadrant,:sextant,:octantmarkers: High-resolution pseudo-pixel rendering. -
Shape::Label: Text labels at canvas coordinates with optional styling.
Scrollbar Widget
-
Full styling support:
thumb_style,track_symbol,track_style,begin_symbol,begin_style,end_symbol,end_style,style. -
All orientation variants:
:vertical_left,:vertical_right,:horizontal_top,:horizontal_bottom(:verticaland:horizontalremain as aliases).
Layout & Constraints
-
Constraint.ratio(numerator, denominator): Proportional constraints with explicit ratio. -
Constraint.fill(weight): Distribute remaining space proportionally. Use multipleFillto split space (e.g.,Fill(1)andFill(3)split 1:3). -
Constraint.max(value): Cap maximum size of a section. -
Layout.split(area, direction:, constraints:, flex:): Compute layout rectangles without rendering, enabling hit testing. -
Flex::SpaceEvenly: New layout mode forLayoutwidget. -
flexparameter: All layout options (:legacy,:start,:center,:end,:space_between,:space_around,:space_evenly).
Rich Text & Text Components
-
Text::SpanandText::Line: Styled text with inline formatting. Combine spans into lines with optional alignment. -
Shapemodule: Canvas shape primitives (Shape::Line,Shape::Circle,Shape::Rectangle,Shape::Point,Shape::Map) to avoid naming conflicts withText::Line.
Event System
-
Typed
EventAPI:RatatuiRuby.poll_eventreturns typed objects (Event::Key,Event::Mouse,Event::Resize,Event::Paste,Event::FocusGained,Event::FocusLost). -
Predicate methods:
key?,mouse?,ctrl?, etc. for cleaner event handling. -
Pattern matching support and discriminator pattern via
type:key in deconstruct_keys. -
Event::Resize: Terminal resize events withwidthandheightattributes. -
Event::Paste: Bracketed paste as atomic event withcontent:. -
Event::FocusGainedandEvent::FocusLost: Terminal focus changes. -
Event::Mouse.newacceptsnilforbuttonparameter (treated as"none").
Geometry & Hit Testing
-
Rect#contains?(x, y): Test whether a point is inside a rectangle. Essential for mouse click handlers. -
Layout.split: Enables calculating widget positions before rendering.
Testing
-
RatatuiRuby::TestHelper#inject_keys: Concise event injection helper. -
RatatuiRuby::TestHelper#get_celland assert_cell_style: Inspect terminal cell attributes (colors, characters). -
with_test_terminal: Default timeout of 2 seconds to prevent hanging tests. Breaking: Default size is now 80Ć24 (VT100 standard) instead of 20Ć10. -
Error on
inject_event/inject_keysoutsidewith_test_terminal: Prevents test hangs from race conditions. -
Value equality (
==) forEventobjects: Simplify assertions.
Lifecycle & Application Structure
-
RatatuiRuby.run: New context manager that initializes terminal, yields session, and restores on exit. Allows custom event loop control. -
Session class: Renamed from
DSLto better reflect its purpose as a managed terminal session with convenience methods. -
Focus and Bracketed Paste events: Enabled by default in
RatatuiRuby.runandRatatuiRuby.init_terminal(disable withfocus_events: falseorbracketed_paste: false).
Documentation & Examples
-
Cached Layout Pattern: Documented in doc/interactive_design.md. Three-phase lifecycle pattern (
calculate_layout,render,handle_input) solves layout duplication in immediate-mode UI. Foundation for Component architecture in Gem 1.5.
Changed
-
Calendar: Renamed
day_styletodefault_styleto match Ratatui 0.30 API. This is a breaking change. [Kerrick Long] -
Custom Widget
renderMethod (Breaking): Changed signature fromrender(area, buffer)torender(area), with render methods now returning an array ofDrawcommands instead of writing directly to a buffer. This change improves memory safety by eliminating use-after-free risks. -
Ratatui Upgraded to 0.30.0: Underlying
ratatuilibrary upgraded from 0.29, bringing modularized crates,no_stdsupport for embedded targets, and major widget/layout enhancements. Layout cache explicitly enabled for performance. -
Event API (Breaking):
RatatuiRuby.poll_eventreturns typedEventobjects instead of raw Hashes. Code usingevent[:type]must change toevent.key?,event.code, etc. -
RatatuiRuby.main_loop Removed (Breaking): Removed in favor of
RatatuiRuby.runfor more explicit lifecycle control. -
TestHelper Terminal Size (Breaking):
with_test_terminaldefaults to 80Ć24 instead of 20Ć10. -
Calendar Month Header Default (Breaking):
show_month_headerdefaults tofalse(previously always shown). Setshow_month_header: trueif relying on the old behavior. -
Gauge
styleDefault (Breaking): No longer defaults toStyle.default. Usegauge_stylefor bar coloring instead.
Fixed
-
Alpine Linux Support: Fixed gem installation failures on Alpine Linux (musl targets) by properly configuring
crate-typeto support static linking where dynamic linking is unsupported. -
Rust Safety: Convert
class.name()results to owned strings for proper GC safety with Magnus 0.8. -
Terminal Preview Detection: Detect staged changes correctly in preview generation.
0.3.1 - 2025-12-28
Added
-
Ruby 4 Support: Updated magnus FFI bindings to use the modern API for Ruby 4.0.0 compatibility.
0.3.0 - 2025-12-28
Added
-
Custom Widget API (Breaking): Custom widgets that define a
rendermethod now receive onlyarea(notbuffer) and must return an array ofDrawcommands. UseRatatuiRuby::Draw.string(x, y, string, style)andRatatuiRuby::Draw.cell(x, y, cell)instead ofbuffer.set_stringandbuffer.set_cell. This eliminates a class of use-after-free bugs by ensuring Ruby never holds pointers to Rust-owned memory. Widgets can now be unit tested by asserting on the returned array. -
The Escape Hatch (Ruby Render Callback): Added the ability to define custom widgets in pure Ruby by implementing a
render(area, buffer)method. TheBufferobject provides low-level drawing primitives likeset_string, allowing developers to create custom TUI components without writing Rust code. -
Clear Widget: Added the
Clearwidget, which resets the terminal buffer in the area it is rendered. This is essential for creating opaque popups and modals that prevent background styles from ābleedingā through transparent widgets. -
Interactive Table Selection: The
Tablewidget now supports row selection withselected_row,highlight_style, andhighlight_symbolparameters. This enables building interactive data grids and file explorers where users can navigate through rows using keyboard input. -
Scrollable Paragraphs: The
Paragraphwidget now supports ascrollparameter that accepts a(y, x)array to scroll content vertically and horizontally. This enables viewing long text content that exceeds the visible area, such as logs or documents. The parameter order matches ratatuiās convention. -
Enhanced Tabs Customization: The
Tabswidget now supportshighlight_stylefor the selected tab and a customizabledividerstring (defaulting to the standard pipe|). This allows for richer visual feedback in tabbed interfaces.
Changed
-
Center Widget: Removed the implicit
Clearcall from theCenterwidget.Centeris now a pure layout widget, requiring an explicitClearwidget if background clearing is desired. This restores correct behavior for transparent overlays.
0.2.0 - 2025-12-24
Added
-
DSL for Simpler Apps: Introduced
RatatuiRuby.main_loop, a new entrypoint that simplifies application structure when you donāt need control of the event loop or application lifecycle. -
Calendar Widget: Added the
Calendarwidget, allowing you to display monthly views and visualize date-based information. -
Generic Charts: Implemented the full
Chartwidget, which supersedes the now-deprecatedLineChartandBarChartwidgets, giving you more freedom to visualize data sets. -
Enhanced List Styling: You can now customize the appearance of selected items in a
Listusinghighlight_styleandhighlight_symbol. -
Broader Ruby Support: Added support for a wider range of Ruby versions: every non-EOL version. The latest preview of Ruby 4.0 is tested in CI, but not supported.
-
Dev Tools: Added internal Rake tasks for managing historical documentation and SemVer checks.
0.1.0 - 2025-12-22
Added
-
First Release: Initial public release of ratatui_ruby, bringing the power of the Rust ratatui library to Rubyists!
-
Core Widget Set: Includes a comprehensive suite of widgets to get you started:
-
Block,Borders, andParagraphfor basic content. -
ListandTablefor structured data. -
GaugeandSparklinefor progress and metrics. -
Tabsfor navigation. -
Canvasfor drawing shapes (Lines, Circles, Rectangles, Maps). -
Layout System: A flexible layout engine using
Flex,Layout, andConstraintsto build responsive interfaces that adapt to any terminal size. -
Forms & Layers: Primitives like
OverlayandCenterfor creating modal dialogs, plus aCursorwidget for text input interactions. -
Styling: Full support for
Ratatuiās styling primitives, including modifiers and RGB/ANSI colors. -
Input Handling: Robust handling for both Keyboard and Mouse events.
-
Testing Support: Included
RatatuiRuby::TestHelperand RSpec integration to make testing your TUI applications possible.