ratatui_ruby 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.builds/ruby-3.2.yml +1 -1
- data/.builds/ruby-3.3.yml +1 -1
- data/.builds/ruby-3.4.yml +1 -1
- data/.builds/ruby-4.0.0.yml +1 -1
- data/AGENTS.md +12 -4
- data/CHANGELOG.md +49 -0
- data/README.md +7 -7
- data/Rakefile +1 -1
- data/doc/{application_architecture.md → concepts/application_architecture.md} +30 -0
- data/doc/{application_testing.md → concepts/application_testing.md} +4 -2
- data/doc/{event_handling.md → concepts/event_handling.md} +1 -1
- data/doc/contributors/auditing/parity.md +233 -0
- data/doc/contributors/developing_examples.md +10 -10
- data/doc/contributors/upstream_requests/tab_rects.md +173 -0
- data/doc/contributors/upstream_requests/title_rects.md +132 -0
- data/doc/contributors/v1.0.0_blockers.md +54 -747
- data/doc/{quickstart.md → getting_started/quickstart.md} +26 -26
- data/doc/{why.md → getting_started/why.md} +1 -1
- data/doc/index.md +23 -9
- data/doc/{terminal_limitations.md → troubleshooting/terminal_limitations.md} +33 -0
- data/doc/troubleshooting/tui_output.md +76 -0
- data/examples/app_all_events/README.md +1 -0
- data/examples/app_all_events/app.rb +2 -0
- data/examples/app_all_events/model/app_model.rb +2 -0
- data/examples/app_all_events/model/event_color_cycle.rb +2 -0
- data/examples/app_all_events/model/event_entry.rb +2 -0
- data/examples/app_all_events/model/msg.rb +2 -0
- data/examples/app_all_events/model/timestamp.rb +2 -0
- data/examples/app_all_events/update.rb +2 -0
- data/examples/app_all_events/view/app_view.rb +2 -0
- data/examples/app_all_events/view/controls_view.rb +2 -0
- data/examples/app_all_events/view/counts_view.rb +2 -0
- data/examples/app_all_events/view/live_view.rb +2 -0
- data/examples/app_all_events/view/log_view.rb +2 -0
- data/examples/app_all_events/view.rb +2 -0
- data/examples/app_color_picker/README.md +2 -0
- data/examples/app_color_picker/app.rb +2 -0
- data/examples/app_color_picker/clipboard.rb +2 -0
- data/examples/app_color_picker/color.rb +2 -0
- data/examples/app_color_picker/controls.rb +2 -0
- data/examples/app_color_picker/copy_dialog.rb +2 -0
- data/examples/app_color_picker/export_pane.rb +2 -0
- data/examples/app_color_picker/harmony.rb +2 -0
- data/examples/app_color_picker/input.rb +2 -0
- data/examples/app_color_picker/main_container.rb +2 -0
- data/examples/app_color_picker/palette.rb +2 -0
- data/examples/app_login_form/README.md +3 -0
- data/examples/app_login_form/app.rb +2 -0
- data/examples/app_stateful_interaction/README.md +2 -0
- data/examples/app_stateful_interaction/app.rb +2 -0
- data/examples/timeout_demo.rb +2 -0
- data/examples/verify_quickstart_dsl/README.md +2 -2
- data/examples/verify_quickstart_dsl/app.rb +2 -0
- data/examples/verify_quickstart_layout/README.md +2 -2
- data/examples/verify_quickstart_layout/app.rb +2 -0
- data/examples/verify_quickstart_lifecycle/README.md +2 -2
- data/examples/verify_quickstart_lifecycle/app.rb +2 -0
- data/examples/verify_readme_usage/app.rb +2 -0
- data/examples/{widget_barchart_demo → widget_barchart}/README.md +5 -3
- data/examples/{widget_barchart_demo → widget_barchart}/app.rb +7 -5
- data/examples/{widget_block_demo → widget_block}/README.md +5 -3
- data/examples/{widget_block_demo → widget_block}/app.rb +6 -4
- data/examples/{widget_box_demo → widget_box}/README.md +7 -4
- data/examples/{widget_box_demo → widget_box}/app.rb +7 -5
- data/examples/{widget_calendar_demo → widget_calendar}/README.md +6 -3
- data/examples/{widget_calendar_demo → widget_calendar}/app.rb +6 -4
- data/examples/{widget_canvas_demo → widget_canvas}/README.md +2 -2
- data/examples/{widget_canvas_demo → widget_canvas}/app.rb +6 -4
- data/examples/{widget_cell_demo → widget_cell}/README.md +6 -3
- data/examples/{widget_cell_demo → widget_cell}/app.rb +7 -5
- data/examples/{widget_center_demo → widget_center}/README.md +2 -2
- data/examples/{widget_center_demo → widget_center}/app.rb +6 -4
- data/examples/{widget_chart_demo → widget_chart}/README.md +7 -4
- data/examples/{widget_chart_demo → widget_chart}/app.rb +7 -5
- data/examples/{widget_gauge_demo → widget_gauge}/README.md +6 -3
- data/examples/{widget_gauge_demo → widget_gauge}/app.rb +7 -5
- data/examples/widget_layout_split/README.md +5 -2
- data/examples/widget_layout_split/app.rb +3 -1
- data/examples/{widget_line_gauge_demo → widget_line_gauge}/README.md +6 -3
- data/examples/{widget_line_gauge_demo → widget_line_gauge}/app.rb +7 -5
- data/examples/{widget_list_demo → widget_list}/README.md +7 -4
- data/examples/{widget_list_demo → widget_list}/app.rb +7 -5
- data/examples/{widget_map_demo → widget_map}/README.md +7 -4
- data/examples/{widget_map_demo → widget_map}/app.rb +4 -2
- data/examples/{widget_overlay_demo → widget_overlay}/README.md +6 -3
- data/examples/{widget_overlay_demo → widget_overlay}/app.rb +5 -3
- data/examples/{widget_popup_demo → widget_popup}/README.md +7 -4
- data/examples/{widget_popup_demo → widget_popup}/app.rb +6 -4
- data/examples/{widget_ratatui_logo_demo → widget_ratatui_logo}/README.md +6 -3
- data/examples/{widget_ratatui_logo_demo → widget_ratatui_logo}/app.rb +8 -6
- data/examples/{widget_ratatui_mascot_demo → widget_ratatui_mascot}/README.md +6 -3
- data/examples/{widget_ratatui_mascot_demo → widget_ratatui_mascot}/app.rb +6 -4
- data/examples/widget_rect/README.md +5 -2
- data/examples/widget_rect/app.rb +2 -0
- data/examples/widget_render/README.md +4 -1
- data/examples/widget_render/app.rb +2 -0
- data/examples/widget_rich_text/README.md +4 -1
- data/examples/widget_rich_text/app.rb +2 -0
- data/examples/widget_scroll_text/README.md +4 -1
- data/examples/widget_scroll_text/app.rb +3 -1
- data/examples/{widget_scrollbar_demo → widget_scrollbar}/README.md +7 -4
- data/examples/{widget_scrollbar_demo → widget_scrollbar}/app.rb +6 -4
- data/examples/{widget_sparkline_demo → widget_sparkline}/README.md +6 -3
- data/examples/{widget_sparkline_demo → widget_sparkline}/app.rb +7 -5
- data/examples/widget_style_colors/README.md +4 -1
- data/examples/widget_style_colors/app.rb +2 -0
- data/examples/{widget_table_demo → widget_table}/README.md +7 -4
- data/examples/{widget_table_demo → widget_table}/app.rb +4 -2
- data/examples/{widget_tabs_demo → widget_tabs}/README.md +6 -3
- data/examples/{widget_tabs_demo → widget_tabs}/app.rb +7 -5
- data/examples/widget_text_width/README.md +5 -2
- data/examples/widget_text_width/app.rb +2 -0
- data/exe/.gitkeep +0 -0
- data/ext/ratatui_ruby/Cargo.lock +1 -1
- data/ext/ratatui_ruby/Cargo.toml +1 -1
- data/ext/ratatui_ruby/extconf.rb +2 -0
- data/ext/ratatui_ruby/src/lib.rs +2 -2
- data/ext/ratatui_ruby/src/rendering.rs +9 -0
- data/ext/ratatui_ruby/src/style.rs +22 -2
- data/ext/ratatui_ruby/src/text.rs +26 -0
- data/ext/ratatui_ruby/src/widgets/barchart.rs +8 -6
- data/ext/ratatui_ruby/src/widgets/chart.rs +31 -4
- data/ext/ratatui_ruby/src/widgets/table.rs +13 -5
- data/ext/ratatui_ruby/src/widgets/tabs.rs +49 -9
- data/lib/ratatui_ruby/buffer/cell.rb +2 -0
- data/lib/ratatui_ruby/buffer.rb +2 -0
- data/lib/ratatui_ruby/cell.rb +2 -0
- data/lib/ratatui_ruby/event/focus_gained.rb +2 -0
- data/lib/ratatui_ruby/event/focus_lost.rb +2 -0
- data/lib/ratatui_ruby/event/key/character.rb +2 -0
- data/lib/ratatui_ruby/event/key/media.rb +2 -0
- data/lib/ratatui_ruby/event/key/modifier.rb +2 -0
- data/lib/ratatui_ruby/event/key/navigation.rb +2 -0
- data/lib/ratatui_ruby/event/key/system.rb +2 -0
- data/lib/ratatui_ruby/event/key.rb +2 -0
- data/lib/ratatui_ruby/event/mouse.rb +2 -0
- data/lib/ratatui_ruby/event/none.rb +2 -0
- data/lib/ratatui_ruby/event/paste.rb +2 -0
- data/lib/ratatui_ruby/event/resize.rb +2 -0
- data/lib/ratatui_ruby/event.rb +2 -0
- data/lib/ratatui_ruby/frame.rb +2 -0
- data/lib/ratatui_ruby/layout/constraint.rb +2 -0
- data/lib/ratatui_ruby/layout/layout.rb +2 -0
- data/lib/ratatui_ruby/layout/rect.rb +2 -0
- data/lib/ratatui_ruby/layout.rb +2 -0
- data/lib/ratatui_ruby/list_state.rb +2 -0
- data/lib/ratatui_ruby/schema/bar_chart/bar.rb +2 -0
- data/lib/ratatui_ruby/schema/bar_chart/bar_group.rb +2 -0
- data/lib/ratatui_ruby/schema/bar_chart.rb +4 -2
- data/lib/ratatui_ruby/schema/block.rb +4 -2
- data/lib/ratatui_ruby/schema/calendar.rb +4 -2
- data/lib/ratatui_ruby/schema/canvas.rb +2 -0
- data/lib/ratatui_ruby/schema/center.rb +2 -0
- data/lib/ratatui_ruby/schema/chart.rb +4 -2
- data/lib/ratatui_ruby/schema/clear.rb +2 -0
- data/lib/ratatui_ruby/schema/constraint.rb +2 -0
- data/lib/ratatui_ruby/schema/cursor.rb +2 -0
- data/lib/ratatui_ruby/schema/draw.rb +2 -0
- data/lib/ratatui_ruby/schema/gauge.rb +4 -2
- data/lib/ratatui_ruby/schema/layout.rb +2 -0
- data/lib/ratatui_ruby/schema/line_gauge.rb +4 -2
- data/lib/ratatui_ruby/schema/list.rb +3 -1
- data/lib/ratatui_ruby/schema/list_item.rb +2 -0
- data/lib/ratatui_ruby/schema/overlay.rb +2 -0
- data/lib/ratatui_ruby/schema/paragraph.rb +2 -0
- data/lib/ratatui_ruby/schema/ratatui_logo.rb +4 -2
- data/lib/ratatui_ruby/schema/ratatui_mascot.rb +4 -2
- data/lib/ratatui_ruby/schema/rect.rb +2 -0
- data/lib/ratatui_ruby/schema/row.rb +2 -0
- data/lib/ratatui_ruby/schema/scrollbar.rb +4 -2
- data/lib/ratatui_ruby/schema/shape/label.rb +2 -0
- data/lib/ratatui_ruby/schema/sparkline.rb +4 -2
- data/lib/ratatui_ruby/schema/style.rb +2 -0
- data/lib/ratatui_ruby/schema/table.rb +2 -0
- data/lib/ratatui_ruby/schema/tabs.rb +4 -2
- data/lib/ratatui_ruby/schema/text.rb +2 -0
- data/lib/ratatui_ruby/scrollbar_state.rb +2 -0
- data/lib/ratatui_ruby/style/style.rb +3 -0
- data/lib/ratatui_ruby/style.rb +2 -0
- data/lib/ratatui_ruby/table_state.rb +2 -0
- data/lib/ratatui_ruby/test_helper/event_injection.rb +2 -0
- data/lib/ratatui_ruby/test_helper/snapshot.rb +62 -21
- data/lib/ratatui_ruby/test_helper/snapshots/axis_labels_alignment.ansi +24 -0
- data/lib/ratatui_ruby/test_helper/snapshots/axis_labels_alignment.txt +24 -0
- data/lib/ratatui_ruby/test_helper/snapshots/barchart_styled_label.ansi +5 -0
- data/lib/ratatui_ruby/test_helper/snapshots/barchart_styled_label.txt +5 -0
- data/lib/ratatui_ruby/test_helper/snapshots/chart_rendering.ansi +24 -0
- data/lib/ratatui_ruby/test_helper/snapshots/chart_rendering.txt +24 -0
- data/lib/ratatui_ruby/test_helper/snapshots/half_block_marker.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/half_block_marker.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_bottom.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_bottom.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_left.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_left.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_right.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_right.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_top.ansi +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/legend_position_top.txt +12 -0
- data/lib/ratatui_ruby/test_helper/snapshots/my_snapshot.txt +1 -0
- data/lib/ratatui_ruby/test_helper/snapshots/styled_axis_title.ansi +10 -0
- data/lib/ratatui_ruby/test_helper/snapshots/styled_axis_title.txt +10 -0
- data/lib/ratatui_ruby/test_helper/snapshots/styled_dataset_name.ansi +10 -0
- data/lib/ratatui_ruby/test_helper/snapshots/styled_dataset_name.txt +10 -0
- data/lib/ratatui_ruby/test_helper/style_assertions.rb +2 -0
- data/lib/ratatui_ruby/test_helper/terminal.rb +5 -0
- data/lib/ratatui_ruby/test_helper/test_doubles.rb +2 -0
- data/lib/ratatui_ruby/test_helper.rb +6 -4
- data/lib/ratatui_ruby/tui/buffer_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/canvas_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/core.rb +2 -0
- data/lib/ratatui_ruby/tui/layout_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/state_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/style_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/text_factories.rb +2 -0
- data/lib/ratatui_ruby/tui/widget_factories.rb +2 -0
- data/lib/ratatui_ruby/tui.rb +2 -0
- data/lib/ratatui_ruby/version.rb +3 -1
- data/lib/ratatui_ruby/widgets/bar_chart/bar.rb +2 -0
- data/lib/ratatui_ruby/widgets/bar_chart/bar_group.rb +2 -0
- data/lib/ratatui_ruby/widgets/bar_chart.rb +7 -4
- data/lib/ratatui_ruby/widgets/block.rb +46 -2
- data/lib/ratatui_ruby/widgets/calendar.rb +4 -2
- data/lib/ratatui_ruby/widgets/canvas.rb +2 -0
- data/lib/ratatui_ruby/widgets/cell.rb +2 -0
- data/lib/ratatui_ruby/widgets/center.rb +2 -0
- data/lib/ratatui_ruby/widgets/chart.rb +13 -6
- data/lib/ratatui_ruby/widgets/clear.rb +2 -0
- data/lib/ratatui_ruby/widgets/cursor.rb +2 -0
- data/lib/ratatui_ruby/widgets/gauge.rb +4 -2
- data/lib/ratatui_ruby/widgets/line_gauge.rb +4 -2
- data/lib/ratatui_ruby/widgets/list.rb +3 -1
- data/lib/ratatui_ruby/widgets/list_item.rb +2 -0
- data/lib/ratatui_ruby/widgets/overlay.rb +2 -0
- data/lib/ratatui_ruby/widgets/paragraph.rb +2 -0
- data/lib/ratatui_ruby/widgets/ratatui_logo.rb +4 -2
- data/lib/ratatui_ruby/widgets/ratatui_mascot.rb +4 -2
- data/lib/ratatui_ruby/widgets/row.rb +2 -0
- data/lib/ratatui_ruby/widgets/scrollbar.rb +4 -2
- data/lib/ratatui_ruby/widgets/shape/label.rb +2 -0
- data/lib/ratatui_ruby/widgets/sparkline.rb +7 -4
- data/lib/ratatui_ruby/widgets/table.rb +2 -0
- data/lib/ratatui_ruby/widgets/tabs.rb +12 -8
- data/lib/ratatui_ruby/widgets.rb +2 -0
- data/lib/ratatui_ruby.rb +130 -9
- data/tasks/autodoc/examples.rb +2 -0
- data/tasks/autodoc/member.rb +2 -0
- data/tasks/autodoc/name.rb +2 -0
- data/tasks/autodoc.rake +2 -0
- data/tasks/bump/cargo_lockfile.rb +2 -0
- data/tasks/bump/changelog.rb +2 -0
- data/tasks/bump/header.rb +2 -0
- data/tasks/bump/history.rb +2 -0
- data/tasks/bump/links.rb +2 -0
- data/tasks/bump/manifest.rb +2 -0
- data/tasks/bump/ruby_gem.rb +2 -0
- data/tasks/bump/sem_ver.rb +2 -0
- data/tasks/bump/unreleased_section.rb +2 -0
- data/tasks/bump.rake +2 -0
- data/tasks/doc.rake +268 -0
- data/tasks/extension.rake +2 -0
- data/tasks/lint.rake +115 -0
- data/tasks/rdoc_config.rb +18 -4
- data/tasks/sourcehut.rake +2 -0
- data/tasks/terminal_preview/app_screenshot.rb +2 -0
- data/tasks/terminal_preview/crash_report.rb +2 -0
- data/tasks/terminal_preview/example_app.rb +2 -0
- data/tasks/terminal_preview/launcher_script.rb +2 -0
- data/tasks/terminal_preview/preview_collection.rb +2 -0
- data/tasks/terminal_preview/preview_timing.rb +2 -0
- data/tasks/terminal_preview/safety_confirmation.rb +2 -0
- data/tasks/terminal_preview/saved_screenshot.rb +2 -0
- data/tasks/terminal_preview/system_appearance.rb +2 -0
- data/tasks/terminal_preview/terminal_window.rb +2 -0
- data/tasks/terminal_preview/window_id.rb +2 -0
- data/tasks/terminal_preview.rake +2 -0
- data/tasks/test.rake +2 -0
- data/tasks/website/index_page.rb +2 -0
- data/tasks/website/version.rb +12 -2
- data/tasks/website/version_menu.rb +2 -0
- data/tasks/website/versioned_documentation.rb +2 -0
- data/tasks/website/website.rb +2 -0
- data/tasks/website.rake +2 -0
- metadata +97 -75
- data/doc/contributors/architectural_overhaul/chat_conversations.md +0 -4952
- data/doc/contributors/architectural_overhaul/implementation_plan.md +0 -60
- data/doc/contributors/architectural_overhaul/task.md +0 -37
- /data/doc/{async.md → concepts/async.md} +0 -0
- /data/doc/{interactive_design.md → concepts/interactive_design.md} +0 -0
- /data/doc/images/{widget_barchart_demo.png → widget_barchart.png} +0 -0
- /data/doc/images/{widget_block_demo.png → widget_block.png} +0 -0
- /data/doc/images/{widget_box_demo.png → widget_box.png} +0 -0
- /data/doc/images/{widget_calendar_demo.png → widget_calendar.png} +0 -0
- /data/doc/images/{widget_canvas_demo.png → widget_canvas.png} +0 -0
- /data/doc/images/{widget_cell_demo.png → widget_cell.png} +0 -0
- /data/doc/images/{widget_center_demo.png → widget_center.png} +0 -0
- /data/doc/images/{widget_chart_demo.png → widget_chart.png} +0 -0
- /data/doc/images/{widget_gauge_demo.png → widget_gauge.png} +0 -0
- /data/doc/images/{widget_line_gauge_demo.png → widget_line_gauge.png} +0 -0
- /data/doc/images/{widget_list_demo.png → widget_list.png} +0 -0
- /data/doc/images/{widget_map_demo.png → widget_map.png} +0 -0
- /data/doc/images/{widget_overlay_demo.png → widget_overlay.png} +0 -0
- /data/doc/images/{widget_popup_demo.png → widget_popup.png} +0 -0
- /data/doc/images/{widget_ratatui_logo_demo.png → widget_ratatui_logo.png} +0 -0
- /data/doc/images/{widget_ratatui_mascot_demo.png → widget_ratatui_mascot.png} +0 -0
- /data/doc/images/{widget_scrollbar_demo.png → widget_scrollbar.png} +0 -0
- /data/doc/images/{widget_sparkline_demo.png → widget_sparkline.png} +0 -0
- /data/doc/images/{widget_table_demo.png → widget_table.png} +0 -0
- /data/doc/images/{widget_tabs_demo.png → widget_tabs.png} +0 -0
- /data/doc/{v0.7.0_migration.md → migration/v0_7_0.md} +0 -0
- /data/doc/{debugging.md → troubleshooting/debugging.md} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f76aaa4da70206d5855ab0d4d7a9356bd57117c1d4ff6d243e86db8bb6e53be9
|
|
4
|
+
data.tar.gz: 88b96b0a71f595d7ca4b255d90f29b3aac3e2fcc02f323d2db9adfaa233bf4a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d8bc1bc8aa2ae2625302e0024f83c6b30459551377f111e9703e9ed9f70fe0c79cc5cd6af57d9770bd5cc7ecfc93e9e8472f7ebde314b1c989a9cff87110bba
|
|
7
|
+
data.tar.gz: b0d285b610e38669c9c764b492e384ae2e9f84739b5572096d70a74818b4ce87f2025c06d9055e55e3e7966c8f0ba9768533ba683ea232a3a77a224ac716f8ed
|
data/.builds/ruby-3.2.yml
CHANGED
data/.builds/ruby-3.3.yml
CHANGED
data/.builds/ruby-3.4.yml
CHANGED
data/.builds/ruby-4.0.0.yml
CHANGED
data/AGENTS.md
CHANGED
|
@@ -27,10 +27,11 @@ Architecture:
|
|
|
27
27
|
|
|
28
28
|
### STRICT REQUIREMENTS
|
|
29
29
|
|
|
30
|
-
- Every file MUST begin with an SPDX-compliant header. Use `AGPL-3.0-or-later` for code; `CC-BY-SA-4.0` for documentation. `reuse annotate` can help you generate the header.
|
|
30
|
+
- Every file MUST begin with an SPDX-compliant header. Use `AGPL-3.0-or-later` for code; `CC-BY-SA-4.0` for documentation. `reuse annotate` can help you generate the header. **For Ruby files**, wrap SPDX comments in `#--` / `#++` to hide them from RDoc output.
|
|
31
31
|
- Every line of Ruby MUST be covered by tests that would stand up to mutation testing.
|
|
32
32
|
- Tests must be meaningful and verify specific behavior or rendering output; simply verifying that code "doesn't crash" is insufficient and unacceptable.
|
|
33
|
-
-
|
|
33
|
+
- **Prefer snapshot tests** (`assert_snapshots`, plural) over manual `buffer_content` assertions for UI widgets. Snapshots are self-documenting and easier to maintain.
|
|
34
|
+
- For UI widgets, use `with_test_terminal` and snapshot assertions to verify terminal buffer content.
|
|
34
35
|
- Every line of Rust MUST be covered by tests that would stand up to mutation testing.
|
|
35
36
|
- Tests must be meaningful; simply verifying that code "doesn't crash" or "compiles" is insufficient and unacceptable.
|
|
36
37
|
- Each widget implementation must have a `tests` module with unit tests verifying basic rendering.
|
|
@@ -78,6 +79,7 @@ The project follows a standard Gem layout with an `ext/` directory for Rust code
|
|
|
78
79
|
|
|
79
80
|
### Development Environment
|
|
80
81
|
|
|
82
|
+
- **Scripting Preference:** Simple `sed` or shell one-liners are fine. When a one-off script grows to multiple lines of logic, prefer a temporary rake task or `ruby -e '...'` over a multi-line shell script in a string. Ruby's `File.read`/`File.write`, `Dir.glob`, and regex handle complex transformations more cleanly.
|
|
81
83
|
|
|
82
84
|
### Documentation
|
|
83
85
|
|
|
@@ -101,6 +103,12 @@ The project follows a standard Gem layout with an `ext/` directory for Rust code
|
|
|
101
103
|
- Skip the body entirely if it's rote, a duplication of the diff, or otherwise unhelpful.
|
|
102
104
|
- **DON'T list the files changed or the edits made in the body.** Don't provide a bulleted list of changes. Use prose to explain the problem and the solution.
|
|
103
105
|
- **DON'T use markdown syntax** (no backticks, no bolding, no lists, no links). The commit message must be plain text.
|
|
106
|
+
- **Type conventions by directory:**
|
|
107
|
+
- `lib/`, `ext/`, `sig/`: Use `feat`, `fix`, `refactor`, `perf` as appropriate.
|
|
108
|
+
- `bin/`, `tasks/`, `.builds/`, CI/CD: Always `chore` (internal tooling).
|
|
109
|
+
- `examples/`: Always `docs` (documentation by example).
|
|
110
|
+
- `test/`: Use `test` for new/changed tests, or match the type of the code being tested.
|
|
111
|
+
- `doc/`: Always `docs`.
|
|
104
112
|
|
|
105
113
|
### 5. Changelog
|
|
106
114
|
|
|
@@ -130,8 +138,8 @@ Before considering a task complete and returning control to the user, you **MUST
|
|
|
130
138
|
|
|
131
139
|
1. **Default Rake Task Passes:** Run `bin/agent_rake` (no args). Confirm it passes with ZERO errors **or warnings**.
|
|
132
140
|
- You will save time if you run `bin/agent_rake rubocop:autocorrect` first.
|
|
133
|
-
- If you think the build is looking for deleted files, it is not. Instead,
|
|
141
|
+
- If you think the build is looking for deleted files, it is not. Instead, explain to the user why staging is needed and use the `run_command` tool with `git add -A` so they get a Run button with context.
|
|
134
142
|
2. **Documentation Updated:** If public APIs or observable behavior changed, update relevant RDoc, rustdoc, `doc/` files, `README.md`, and/or `ratatui_ruby-wiki` files.
|
|
135
143
|
3. **Changelog Updated:** If public APIs, observable behavior, or gemspec dependencies have changed, update [CHANGELOG.md](CHANGELOG.md)'s **Unreleased** section.
|
|
136
144
|
4. **Commit Message Suggested:** You **MUST** ensure the final message to the user includes a suggested commit message block. This is NOT optional.
|
|
137
|
-
- You MUST also
|
|
145
|
+
- You MUST also check `git log -n1` to see the current standard AI footer ("Generated with" and "Co-Authored-By") and include it in your suggested message.
|
data/CHANGELOG.md
CHANGED
|
@@ -12,10 +12,57 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
12
12
|
|
|
13
13
|
### Added
|
|
14
14
|
|
|
15
|
+
- **Block Inner Area Calculation**: `Block#inner(area)` method computes the inner content area given an outer `Rect`, accounting for borders and padding. Essential for layout calculations when you need to know usable space inside a block.
|
|
16
|
+
- **Deferred Warnings During TUI Sessions**: Experimental feature warnings (like `Paragraph#line_count`) are now automatically queued during active TUI sessions and flushed to stderr after `restore_terminal`. This prevents warnings from corrupting the TUI display. See `doc/troubleshooting/tui_output.md` for details on handling terminal output during TUI sessions.
|
|
17
|
+
- **Session State Tracking**: `RatatuiRuby.terminal_active?` indicates whether a TUI session is active. Calling `init_terminal` or `init_test_terminal` while a session is already active now raises `Error::Invariant`.
|
|
18
|
+
- **Error::Invariant**: New error class for state invariant violations (e.g., double-init). Distinct from `Error::Safety` (lifetime violations) and `Error::Terminal` (operational I/O failures).
|
|
15
19
|
### Changed
|
|
16
20
|
|
|
17
21
|
### Fixed
|
|
18
22
|
|
|
23
|
+
- **Direct Text Rendering**: `Text::Line` and `Text::Span` can now be rendered directly as widgets via `frame.render_widget(line, area)` without wrapping in a `Paragraph`. Previously, these text primitives were silently ignored when passed to `render_widget`.
|
|
24
|
+
- **Text Line Alignment**: `Text::Line` `alignment:` parameter is now respected during rendering. Previously, the alignment was ignored and text always rendered left-aligned.
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
## [0.7.3] - 2026-01-04
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **Symbol Shortcuts for `bar_set`**: `Sparkline` and `BarChart` now accept `:nine_levels` (full 9-character gradient) and `:three_levels` (simplified empty/half/full) as intuitive shortcuts instead of requiring custom character hashes.
|
|
33
|
+
- **`:half_block` Marker**: `Chart` `Dataset` now supports `:half_block` marker for higher resolution rendering using ▀ and ▄ characters.
|
|
34
|
+
- **`assert_snapshots` Method**: `RatatuiRuby::TestHelper#assert_snapshots` (plural) calls both `assert_plain_snapshot` and `assert_rich_snapshot` with the same name, generating both `.txt` and `.ansi` files for documentation and display purposes.
|
|
35
|
+
- **Edge-Center Legend Positions**: `Chart` `legend_position` now accepts `:top`, `:bottom`, `:left`, and `:right` in addition to the existing corner positions (`:top_left`, `:top_right`, `:bottom_left`, `:bottom_right`).
|
|
36
|
+
- **`:reset` Color**: `Style` `fg` and `bg` now accept `:reset` to explicitly clear any inherited foreground or background color, restoring the terminal's default.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
### Deprecated
|
|
41
|
+
|
|
42
|
+
- **`assert_snapshot`**: Use `assert_snapshots` (plural) instead, or `assert_plain_snapshot` if you only need plain text. The old method name lacked clarity about whether it captured plain text or styled ANSI output.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
### Removed
|
|
47
|
+
|
|
48
|
+
## [0.7.2] - 2026-01-04
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- **Tabs `padding_left` and `padding_right`**: Now accept `Integer` (for spaces), `String`, or `Text::Line` for styled padding content. Previously only accepted `Integer`. Passing a `Line` object allows colored or decorated padding.
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- **Styled Text Parsing**: Fixed multiple widgets incorrectly rendering styled text objects as Ruby inspect strings (e.g., `#<data RatatuiRuby::Text::Span...>`) instead of their styled content:
|
|
59
|
+
- `Tabs` `divider`: Now correctly renders `Text::Span` objects.
|
|
60
|
+
- `Table` `highlight_symbol`: Now correctly renders `Text::Span` objects.
|
|
61
|
+
- `BarChart` `BarGroup` `label`: Now correctly renders `Text::Line` objects.
|
|
62
|
+
- `Chart` `Axis` `title`: Now correctly renders `Text::Line` objects.
|
|
63
|
+
- `Chart` `Axis` `labels`: Now correctly renders `Text::Line` objects.
|
|
64
|
+
- `Chart` `Dataset` `name`: Now correctly renders `Text::Line` objects.
|
|
65
|
+
|
|
19
66
|
### Removed
|
|
20
67
|
|
|
21
68
|
## [0.7.1] - 2026-01-03
|
|
@@ -368,6 +415,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
368
415
|
- **Testing Support**: Included `RatatuiRuby::TestHelper` and RSpec integration to make testing your TUI applications possible.
|
|
369
416
|
|
|
370
417
|
[Unreleased]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/HEAD
|
|
418
|
+
[0.7.3]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.3
|
|
419
|
+
[0.7.2]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.2
|
|
371
420
|
[0.7.1]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.1
|
|
372
421
|
[0.7.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.0
|
|
373
422
|
[0.6.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.6.0
|
data/README.md
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://builds.sr.ht/~kerrick/ratatui_ruby?) [%22&replace=%241&label=License&color=a2c93e)](https://spdx.org/licenses/AGPL-3.0-or-later.html) [](https://rubygems.org/gems/ratatui_ruby) [](https://rubygems.org/gems/ratatui_ruby) [](https://crates.io/crates/ratatui/0.30) [](https://lists.sr.ht/~kerrick/ratatui_ruby-discuss) [](https://lists.sr.ht/~kerrick/ratatui_ruby-devel) [](https://lists.sr.ht/~kerrick/ratatui_ruby-announce)
|
|
@@ -23,7 +23,7 @@ Mailing List: Announcements](https://img.shields.io/badge/mailing_list-announcem
|
|
|
23
23
|
> [!WARNING]
|
|
24
24
|
> **ratatui_ruby** is currently in **BETA**. The API may change between minor versions.
|
|
25
25
|
|
|
26
|
-
**[Why RatatuiRuby?](./doc/why.md)** — Native Rust performance, zero runtime overhead, and Ruby's expressiveness. [See how we compare](./doc/why.md) to CharmRuby, raw Rust, and Go.
|
|
26
|
+
**[Why RatatuiRuby?](./doc/getting_started/why.md)** — Native Rust performance, zero runtime overhead, and Ruby's expressiveness. [See how we compare](./doc/getting_started/why.md) to CharmRuby, raw Rust, and Go.
|
|
27
27
|
|
|
28
28
|
Please join the **announce** mailing list at https://lists.sr.ht/~kerrick/ratatui_ruby-announce to stay up-to-date on new releases and announcements. See the [`trunk` branch](https://git.sr.ht/~kerrick/ratatui_ruby/tree/trunk) for pre-release updates.
|
|
29
29
|
|
|
@@ -96,7 +96,7 @@ end
|
|
|
96
96
|
|
|
97
97
|

|
|
98
98
|
|
|
99
|
-
For a full tutorial, see [the Quickstart](./doc/quickstart.md). For an explanation of the application architecture, see [Application Architecture](./doc/application_architecture.md).
|
|
99
|
+
For a full tutorial, see [the Quickstart](./doc/getting_started/quickstart.md). For an explanation of the application architecture, see [Application Architecture](./doc/concepts/application_architecture.md).
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
## Features
|
|
@@ -118,9 +118,9 @@ Plus: flexible layouts with constraints, full keyboard/mouse/paste/resize events
|
|
|
118
118
|
|
|
119
119
|
| Resource | Description |
|
|
120
120
|
|----------|-------------|
|
|
121
|
-
| [Quickstart](./doc/quickstart.md) | Get running in 5 minutes |
|
|
122
|
-
| [Widget Gallery](./doc/quickstart.md#widget-demos) | Every widget with examples |
|
|
123
|
-
| [Application Architecture](./doc/application_architecture.md) | Patterns for scaling your app |
|
|
121
|
+
| [Quickstart](./doc/getting_started/quickstart.md) | Get running in 5 minutes |
|
|
122
|
+
| [Widget Gallery](./doc/getting_started/quickstart.md#widget-demos) | Every widget with examples |
|
|
123
|
+
| [Application Architecture](./doc/concepts/application_architecture.md) | Patterns for scaling your app |
|
|
124
124
|
| [API Reference](./doc/index.md) | Full RDoc documentation |
|
|
125
125
|
| [Wiki](https://man.sr.ht/~kerrick/ratatui_ruby) | Guides and community resources |
|
|
126
126
|
|
data/Rakefile
CHANGED
|
@@ -52,6 +52,36 @@ ensure
|
|
|
52
52
|
end
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
#### Signal Handling
|
|
56
|
+
|
|
57
|
+
External processes send signals. Your TUI must handle them gracefully.
|
|
58
|
+
|
|
59
|
+
**The Problem:** If a signal terminates your process before `restore_terminal` runs, the terminal stays in raw mode. Your shell becomes unusable until you type `reset` and press Enter (the text won't echo, but it works).
|
|
60
|
+
|
|
61
|
+
**The Solution:** Ruby's default signal handlers work correctly with `ensure` blocks. Most signals unwind the stack, which triggers cleanup.
|
|
62
|
+
|
|
63
|
+
| Signal | Source | Terminal Restored? |
|
|
64
|
+
|--------|--------|--------------------|
|
|
65
|
+
| SIGTERM | `kill -15` | ✓ Yes — ensure runs |
|
|
66
|
+
| SIGINT | `kill -2` (not Ctrl+C) | ✓ Yes — ensure runs |
|
|
67
|
+
| SIGKILL | `kill -9` | ✗ No — cannot be caught |
|
|
68
|
+
|
|
69
|
+
> [!IMPORTANT]
|
|
70
|
+
> **Ctrl+C in Raw Mode:** When your app is in raw mode, pressing Ctrl+C does *not* send SIGINT. It's captured as a `:ctrl_c` key event. Handle this in your event loop—don't use `trap("INT")`.
|
|
71
|
+
|
|
72
|
+
```ruby
|
|
73
|
+
RatatuiRuby.run do |tui|
|
|
74
|
+
loop do
|
|
75
|
+
# ...
|
|
76
|
+
event = tui.poll_event
|
|
77
|
+
break if event == :ctrl_c # Handle Ctrl+C yourself
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Recovery:** If a TUI app leaves your terminal broken, run `reset` in the shell to restore normal behavior.
|
|
83
|
+
|
|
84
|
+
|
|
55
85
|
### Stateful Widgets
|
|
56
86
|
|
|
57
87
|
Most widgets are stateless configuration. You create them, render them, and they are gone. However, the **runtime status** of some widgets (like Lists and Tables) must persist across frames (e.g., scroll offsets or selection).
|
|
@@ -103,15 +103,17 @@ See [RatatuiRuby::TestHelper::EventInjection](../lib/ratatui_ruby/test_helper/ev
|
|
|
103
103
|
|
|
104
104
|
Snapshots let you verify complex layouts without manually asserting every line.
|
|
105
105
|
|
|
106
|
-
Use `
|
|
106
|
+
Use `assert_snapshots` to compare the current screen against stored reference files.
|
|
107
107
|
|
|
108
108
|
```ruby
|
|
109
109
|
with_test_terminal do
|
|
110
110
|
MyApp.new.run
|
|
111
|
-
|
|
111
|
+
assert_snapshots("dashboard_view")
|
|
112
112
|
end
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
This generates both `.txt` (plain text) and `.ansi` (styled) snapshot files. The `.ansi` files contain ANSI escape codes—`cat` them in a terminal to see exactly what the screen looked like. For a visual tour of your test suite, try `cat **/*.ansi` in any shell that supports globbing.
|
|
116
|
+
|
|
115
117
|
### Handling Non-Determinism
|
|
116
118
|
|
|
117
119
|
Snapshots must be deterministic. Random data or current timestamps will cause test failures ("flakes").
|
|
@@ -4,7 +4,7 @@ SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
|
4
4
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
|
-
# Event Handling
|
|
7
|
+
# Event Handling
|
|
8
8
|
|
|
9
9
|
`ratatui_ruby` provides a rich, object-oriented event system that supports multiple coding styles, from simple boolean predicates to modern Ruby pattern matching.
|
|
10
10
|
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Parity Auditing Process
|
|
7
|
+
|
|
8
|
+
This guide describes the **process** for auditing RatatuiRuby against upstream Rust Ratatui to find API parity gaps of any kind.
|
|
9
|
+
|
|
10
|
+
## Philosophy
|
|
11
|
+
|
|
12
|
+
RatatuiRuby should behave identically to Rust Ratatui. When a Rust user can do something with a widget, a Ruby user should be able to do the equivalent. Deviations are bugs.
|
|
13
|
+
|
|
14
|
+
## The Audit Mindset
|
|
15
|
+
|
|
16
|
+
### Ask the Right Questions
|
|
17
|
+
|
|
18
|
+
Every audit begins with a question:
|
|
19
|
+
|
|
20
|
+
- "Does RatatuiRuby support everything upstream supports for widget X?"
|
|
21
|
+
- "When I pass type Y to parameter Z, does Ruby do what Rust does?"
|
|
22
|
+
- "Are there features in upstream that we haven't exposed at all?"
|
|
23
|
+
|
|
24
|
+
### Symptoms That Trigger Audits
|
|
25
|
+
|
|
26
|
+
- **Inspect strings in output** (`#<data RatatuiRuby::...>`) — type conversion failure
|
|
27
|
+
- **Missing methods** — user can't access upstream functionality
|
|
28
|
+
- **Wrong behavior** — code runs but produces different results than Rust
|
|
29
|
+
- **Type mismatches** — Ruby API accepts different types than Rust API
|
|
30
|
+
|
|
31
|
+
## The Three-Layer Model
|
|
32
|
+
|
|
33
|
+
Every RatatuiRuby feature has three layers. Gaps can occur at any layer:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
┌─────────────────────────────┐
|
|
37
|
+
│ Ruby API (lib/**/*.rb) │ ← What users see
|
|
38
|
+
├─────────────────────────────┤
|
|
39
|
+
│ Rust Bindings (ext/**/*.rs)│ ← Bridge layer
|
|
40
|
+
├─────────────────────────────┤
|
|
41
|
+
│ Upstream Ratatui │ ← Source of truth
|
|
42
|
+
└─────────────────────────────┘
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Layer 1: Ruby API Gaps
|
|
46
|
+
Ruby doesn't expose a parameter that upstream supports.
|
|
47
|
+
|
|
48
|
+
### Layer 2: Binding Gaps
|
|
49
|
+
Ruby exposes a parameter, but the Rust binding converts it incorrectly.
|
|
50
|
+
|
|
51
|
+
### Layer 3: Upstream Changes
|
|
52
|
+
New upstream features we haven't implemented yet.
|
|
53
|
+
|
|
54
|
+
## Audit Process
|
|
55
|
+
|
|
56
|
+
### 1. Choose an Audit Scope
|
|
57
|
+
|
|
58
|
+
Define what you're auditing:
|
|
59
|
+
- **Single widget**: All parameters of `Tabs`
|
|
60
|
+
- **Single feature**: All places that accept styled text
|
|
61
|
+
- **Version delta**: Everything new in Ratatui 0.29
|
|
62
|
+
|
|
63
|
+
### 2. Establish Source of Truth
|
|
64
|
+
|
|
65
|
+
For any scope, identify the authoritative upstream source:
|
|
66
|
+
- **Method signatures** → Rust source files
|
|
67
|
+
- **Type constraints** → Generic bounds (`Into<Line>`, `&str`, etc.)
|
|
68
|
+
- **Behavior** → Upstream documentation and tests
|
|
69
|
+
|
|
70
|
+
### 3. Inventory Our Implementation
|
|
71
|
+
|
|
72
|
+
List everything in our codebase related to the scope:
|
|
73
|
+
- Ruby classes and methods
|
|
74
|
+
- Rust binding functions
|
|
75
|
+
- Conversion/parsing logic
|
|
76
|
+
|
|
77
|
+
### 4. Compare Systematically
|
|
78
|
+
|
|
79
|
+
For each item in the upstream source of truth, ask:
|
|
80
|
+
1. Do we expose this at all?
|
|
81
|
+
2. If yes, does our implementation match the type signature?
|
|
82
|
+
3. If yes, does our behavior match?
|
|
83
|
+
|
|
84
|
+
### 5. Document Findings
|
|
85
|
+
|
|
86
|
+
For each gap found, record:
|
|
87
|
+
- What the gap is
|
|
88
|
+
- Where it occurs (files, lines)
|
|
89
|
+
- What upstream expects
|
|
90
|
+
- What we currently do
|
|
91
|
+
|
|
92
|
+
### 6. Fix and Verify
|
|
93
|
+
|
|
94
|
+
Apply fixes, then verify:
|
|
95
|
+
- Compiles without errors
|
|
96
|
+
- Tests pass
|
|
97
|
+
- Visual/manual verification if applicable
|
|
98
|
+
|
|
99
|
+
## Verifying Completeness
|
|
100
|
+
|
|
101
|
+
Finding gaps is not enough. You must verify you've found **all** gaps within your scope.
|
|
102
|
+
|
|
103
|
+
### The Completeness Mindset
|
|
104
|
+
|
|
105
|
+
An initial audit pass often finds the obvious issues. But "obvious" means "incomplete." After your first pass, stop and ask:
|
|
106
|
+
|
|
107
|
+
- Did I search for **every variation** of the pattern I was looking for?
|
|
108
|
+
- Are there **synonyms or related terms** I should also search?
|
|
109
|
+
- Did I check **all code paths**, not just the happy path?
|
|
110
|
+
- Are there **duplicate implementations** (e.g., `render` vs `render_stateful`)?
|
|
111
|
+
|
|
112
|
+
### Broaden Your Search Terms
|
|
113
|
+
|
|
114
|
+
Your first search term won't catch everything. For each pattern, think of variations:
|
|
115
|
+
|
|
116
|
+
| If you searched for... | Also search for... |
|
|
117
|
+
|------------------------|-------------------|
|
|
118
|
+
| `funcall("to_s"` | `String::try_convert` |
|
|
119
|
+
| `Into<Line>` | `Into<Span>`, `Into<Text>` |
|
|
120
|
+
| One widget's file | All widget files |
|
|
121
|
+
| The method you're fixing | Related methods in the same file |
|
|
122
|
+
|
|
123
|
+
### Work From the Complete List
|
|
124
|
+
|
|
125
|
+
Don't spot-check. Generate the **complete list** of potential issues, then classify each one:
|
|
126
|
+
|
|
127
|
+
1. Run a search that catches all possible instances
|
|
128
|
+
2. Count them (e.g., "31 `to_s` call sites")
|
|
129
|
+
3. Review **every single one**, marking each as "gap" or "correct"
|
|
130
|
+
|
|
131
|
+
Half-measures lead to half-fixes.
|
|
132
|
+
|
|
133
|
+
### Verify Against Upstream Exhaustively
|
|
134
|
+
|
|
135
|
+
For type-related gaps, don't just check the methods you already know about. Search upstream for **all uses of the pattern**:
|
|
136
|
+
|
|
137
|
+
- `grep -rn 'Into<Line' /path/to/ratatui/src/widgets` finds EVERY place upstream accepts `Line`
|
|
138
|
+
- Then verify we handle EACH of those correctly
|
|
139
|
+
|
|
140
|
+
### Question Your Assumptions
|
|
141
|
+
|
|
142
|
+
After completing your audit, challenge yourself:
|
|
143
|
+
|
|
144
|
+
- "Is there anywhere I should look that I haven't?"
|
|
145
|
+
- "Is there any term I should search that I haven't?"
|
|
146
|
+
- "Am I sure I didn't miss anything?"
|
|
147
|
+
|
|
148
|
+
If you can't answer confidently, keep searching.
|
|
149
|
+
|
|
150
|
+
### The "One More Pass" Rule
|
|
151
|
+
|
|
152
|
+
When you think you're done, do one more verification pass with a different approach:
|
|
153
|
+
|
|
154
|
+
- If you searched our code first, now search upstream first
|
|
155
|
+
- If you searched for method names, now search for type signatures
|
|
156
|
+
- If you audited file-by-file, now audit feature-by-feature
|
|
157
|
+
|
|
158
|
+
This catches gaps your initial framing missed.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## Search Strategies
|
|
162
|
+
|
|
163
|
+
Different gap types require different search approaches:
|
|
164
|
+
|
|
165
|
+
### Finding Type Conversion Gaps
|
|
166
|
+
|
|
167
|
+
Look for places where we convert Ruby objects to simpler types:
|
|
168
|
+
- `funcall("to_s", ...)` — converting to string
|
|
169
|
+
- `String::try_convert(...)` — same
|
|
170
|
+
- `u16::try_convert(...)` — numeric conversion
|
|
171
|
+
|
|
172
|
+
Then check: does upstream accept richer types?
|
|
173
|
+
|
|
174
|
+
### Finding Missing Features
|
|
175
|
+
|
|
176
|
+
Compare file structure:
|
|
177
|
+
- What files/modules exist upstream?
|
|
178
|
+
- What methods exist in each upstream struct?
|
|
179
|
+
- What parameters does each upstream method accept?
|
|
180
|
+
|
|
181
|
+
### Finding Behavioral Differences
|
|
182
|
+
|
|
183
|
+
Run equivalent code in both environments and compare output.
|
|
184
|
+
|
|
185
|
+
## Red Flags in Our Code
|
|
186
|
+
|
|
187
|
+
When reviewing RatatuiRuby code, these patterns suggest potential gaps:
|
|
188
|
+
|
|
189
|
+
| Pattern | Potential Gap |
|
|
190
|
+
|---------|---------------|
|
|
191
|
+
| `funcall("to_s", ...)` | Upstream may accept styled types |
|
|
192
|
+
| `usize` or `u16` for padding | Upstream may accept content types |
|
|
193
|
+
| Missing `parse_*` call before using a value | Type not being converted properly |
|
|
194
|
+
| Widget with fewer Ruby methods than Rust methods | Missing functionality |
|
|
195
|
+
| `// TODO` or `// FIXME` comments | Known gaps |
|
|
196
|
+
|
|
197
|
+
## Upstream Patterns to Watch For
|
|
198
|
+
|
|
199
|
+
When reading upstream Rust code, these signatures indicate rich type support:
|
|
200
|
+
|
|
201
|
+
| Rust Signature | Meaning | Ruby Should Accept |
|
|
202
|
+
|----------------|---------|-------------------|
|
|
203
|
+
| `Into<Span<'a>>` | Styled single fragment | `Text::Span` or `String` |
|
|
204
|
+
| `Into<Line<'a>>` | Styled line | `Text::Line`, `Text::Span`, or `String` |
|
|
205
|
+
| `Into<Text<'a>>` | Multi-line styled | `Text::Text`, `Text::Line`, or `String` |
|
|
206
|
+
| `T: AsRef<str>` | Any string-like | `String` (OK) |
|
|
207
|
+
| `&'a str` | String slice | `String` (OK) |
|
|
208
|
+
|
|
209
|
+
## Keeping Audits Maintainable
|
|
210
|
+
|
|
211
|
+
### Create Checklists
|
|
212
|
+
|
|
213
|
+
For each widget or feature area, maintain a checklist of all parameters with their expected types.
|
|
214
|
+
|
|
215
|
+
### Track Upstream Changes
|
|
216
|
+
|
|
217
|
+
When upgrading Ratatui versions:
|
|
218
|
+
1. Read the changelog
|
|
219
|
+
2. Search for new `pub fn` in widget files
|
|
220
|
+
3. Audit new functionality before exposing it
|
|
221
|
+
|
|
222
|
+
### Automate Where Possible
|
|
223
|
+
|
|
224
|
+
Consider tooling that:
|
|
225
|
+
- Compares upstream method counts to ours
|
|
226
|
+
- Flags new `to_s` calls in code review
|
|
227
|
+
- Tests styled content rendering
|
|
228
|
+
|
|
229
|
+
## Example Audit Narrative
|
|
230
|
+
|
|
231
|
+
> "I noticed inspect strings appearing in my tabs. I asked: 'What types does upstream accept for the divider parameter?' I found `Into<Span>`. I then asked: 'What does our binding do?' I found we call `to_s`. Gap identified."
|
|
232
|
+
|
|
233
|
+
This narrative approach—asking questions, finding answers, comparing—works for any parity issue.
|
|
@@ -62,7 +62,7 @@ MyExampleApp.new.run if __FILE__ == $PROGRAM_NAME
|
|
|
62
62
|
|
|
63
63
|
Example directories **must** follow a prefixing convention to categorize them alphabetically:
|
|
64
64
|
- `app_`: Application showcases (e.g., `app_analytics`). Class name: `AppAnalytics`.
|
|
65
|
-
- `widget_`: Widget-focused demonstrations (e.g., `
|
|
65
|
+
- `widget_`: Widget-focused demonstrations (e.g., `widget_gauge`). Class name: `WidgetGaugeDemo`.
|
|
66
66
|
- `verify_`: Documentation verification examples (e.g., `verify_readme_usage`). Class name: `VerifyReadmeUsage`.
|
|
67
67
|
|
|
68
68
|
The directory and class names must match (snake_case directory maps to PascalCase class).
|
|
@@ -112,7 +112,7 @@ examples/
|
|
|
112
112
|
test/examples/
|
|
113
113
|
my_example/
|
|
114
114
|
test_app.rb ← REQUIRED: Tests (centralized, not local to example)
|
|
115
|
-
snapshots/ ← Auto-created by
|
|
115
|
+
snapshots/ ← Auto-created by snapshot assertions
|
|
116
116
|
initial_render.txt
|
|
117
117
|
|
|
118
118
|
sig/examples/
|
|
@@ -223,7 +223,7 @@ class TestMyExampleApp < Minitest::Test
|
|
|
223
223
|
with_test_terminal do
|
|
224
224
|
inject_key(:q)
|
|
225
225
|
@app.run
|
|
226
|
-
|
|
226
|
+
assert_snapshots("initial_render")
|
|
227
227
|
end
|
|
228
228
|
end
|
|
229
229
|
end
|
|
@@ -231,7 +231,7 @@ end
|
|
|
231
231
|
|
|
232
232
|
## Snapshot Testing Pattern (REQUIRED)
|
|
233
233
|
|
|
234
|
-
All example tests MUST use snapshot testing via the `
|
|
234
|
+
All example tests MUST use snapshot testing via the `assert_snapshots` API, not manual content assertions.
|
|
235
235
|
|
|
236
236
|
### Why Snapshots
|
|
237
237
|
|
|
@@ -249,20 +249,20 @@ def test_initial_render
|
|
|
249
249
|
inject_key(:q)
|
|
250
250
|
@app.run
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
assert_snapshots("initial_render")
|
|
253
253
|
end
|
|
254
254
|
end
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
Snapshot auto-saved to: `test/examples/
|
|
257
|
+
Snapshot auto-saved to: `test/examples/widget_foo/snapshots/initial_render.txt`
|
|
258
258
|
|
|
259
259
|
### With Normalization (for dynamic content)
|
|
260
260
|
|
|
261
261
|
For examples with timestamps, random data, or other non-deterministic output:
|
|
262
262
|
|
|
263
263
|
```ruby
|
|
264
|
-
private def
|
|
265
|
-
|
|
264
|
+
private def assert_normalized_snapshots(snapshot_name)
|
|
265
|
+
assert_plain_snapshot(snapshot_name) do |actual|
|
|
266
266
|
actual.map do |line|
|
|
267
267
|
line.gsub(/\d{2}:\d{2}:\d{2}/, "XX:XX:XX") # Mask timestamps
|
|
268
268
|
.gsub(/Random ID: \d+/, "Random ID: XXX") # Mask random values
|
|
@@ -276,7 +276,7 @@ def test_after_event
|
|
|
276
276
|
inject_key(:q)
|
|
277
277
|
@app.run
|
|
278
278
|
|
|
279
|
-
|
|
279
|
+
assert_normalized_snapshots("after_event")
|
|
280
280
|
end
|
|
281
281
|
end
|
|
282
282
|
```
|
|
@@ -320,7 +320,7 @@ Examples must use **realistic, meaningful data**—not dummy placeholder text. T
|
|
|
320
320
|
|
|
321
321
|
**For small datasets (< 10 items):**
|
|
322
322
|
Use hardcoded realistic data. Examples:
|
|
323
|
-
- Geographic coordinates with city names (see `
|
|
323
|
+
- Geographic coordinates with city names (see `widget_map/app.rb`)
|
|
324
324
|
- Real product names or person names
|
|
325
325
|
- Meaningful status values ("Completed", "Pending", "Failed")
|
|
326
326
|
|