ratatui_ruby 0.7.0 → 0.7.2
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 +8 -1
- data/CHANGELOG.md +34 -0
- data/README.md +5 -5
- data/Rakefile +1 -1
- data/doc/{application_architecture.md → concepts/application_architecture.md} +30 -0
- data/doc/concepts/async.md +160 -0
- 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 +3 -3
- data/doc/contributors/v1.0.0_blockers.md +8 -8
- 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/troubleshooting/debugging.md +71 -0
- data/doc/{terminal_limitations.md → troubleshooting/terminal_limitations.md} +33 -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/style.rs +25 -9
- data/ext/ratatui_ruby/src/widgets/barchart.rs +8 -6
- data/ext/ratatui_ruby/src/widgets/chart.rs +26 -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 +2 -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 +2 -0
- data/lib/ratatui_ruby/test_helper/style_assertions.rb +2 -0
- data/lib/ratatui_ruby/test_helper/terminal.rb +2 -0
- data/lib/ratatui_ruby/test_helper/test_doubles.rb +2 -0
- data/lib/ratatui_ruby/test_helper.rb +5 -3
- 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 +4 -2
- data/lib/ratatui_ruby/widgets/block.rb +4 -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 +4 -2
- 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 +4 -2
- 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 +2 -0
- 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 +10 -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 +14 -0
- data/tasks/bump/sem_ver.rb +2 -0
- data/tasks/bump/unreleased_section.rb +18 -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 +72 -72
- 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/{application_testing.md → concepts/application_testing.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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52112877db56e3edf7a4baa4c542b55570e8b1172a172934e229c0730d33ca2c
|
|
4
|
+
data.tar.gz: 1f46e0c790f33828dba5ed4cfa6ea6d56d5525634cc587d0986005e287c6b876
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ee6665ca41a8029b67f9d99ac4908ad5ab124cc8d21952d7a42e3eb3bce0dfd2ef77e19b69294a7c5e2bb1a8bb745047a8f7599712e497ba0c66d3e8607e351
|
|
7
|
+
data.tar.gz: '085180a5bab1b831521750b42398087109129fda7d20fe369b7aa4ff5c746e691e09f82a4251bc62ca964508ed21d9276ace9970ed91fec3fd979923ea2937a5'
|
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,7 +27,7 @@ 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
|
- For UI widgets, this means using `with_test_terminal` to verify EVERY character of the terminal buffer's content.
|
|
@@ -78,6 +78,7 @@ The project follows a standard Gem layout with an `ext/` directory for Rust code
|
|
|
78
78
|
|
|
79
79
|
### Development Environment
|
|
80
80
|
|
|
81
|
+
- **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
82
|
|
|
82
83
|
### Documentation
|
|
83
84
|
|
|
@@ -101,6 +102,12 @@ The project follows a standard Gem layout with an `ext/` directory for Rust code
|
|
|
101
102
|
- Skip the body entirely if it's rote, a duplication of the diff, or otherwise unhelpful.
|
|
102
103
|
- **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
104
|
- **DON'T use markdown syntax** (no backticks, no bolding, no lists, no links). The commit message must be plain text.
|
|
105
|
+
- **Type conventions by directory:**
|
|
106
|
+
- `lib/`, `ext/`, `sig/`: Use `feat`, `fix`, `refactor`, `perf` as appropriate.
|
|
107
|
+
- `bin/`, `tasks/`, `.builds/`, CI/CD: Always `chore` (internal tooling).
|
|
108
|
+
- `examples/`: Always `docs` (documentation by example).
|
|
109
|
+
- `test/`: Use `test` for new/changed tests, or match the type of the code being tested.
|
|
110
|
+
- `doc/`: Always `docs`.
|
|
104
111
|
|
|
105
112
|
### 5. Changelog
|
|
106
113
|
|
data/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,38 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
18
18
|
|
|
19
19
|
### Removed
|
|
20
20
|
|
|
21
|
+
## [0.7.2] - 2026-01-04
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **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.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **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:
|
|
32
|
+
- `Tabs` `divider`: Now correctly renders `Text::Span` objects.
|
|
33
|
+
- `Table` `highlight_symbol`: Now correctly renders `Text::Span` objects.
|
|
34
|
+
- `BarChart` `BarGroup` `label`: Now correctly renders `Text::Line` objects.
|
|
35
|
+
- `Chart` `Axis` `title`: Now correctly renders `Text::Line` objects.
|
|
36
|
+
- `Chart` `Axis` `labels`: Now correctly renders `Text::Line` objects.
|
|
37
|
+
- `Chart` `Dataset` `name`: Now correctly renders `Text::Line` objects.
|
|
38
|
+
|
|
39
|
+
### Removed
|
|
40
|
+
|
|
41
|
+
## [0.7.1] - 2026-01-03
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **Block Title Styling**: `Block` title `content` now correctly renders `Text::Line` objects with styled spans. Previously, passing a styled `Line` as title content displayed its Ruby inspect representation (e.g., `#<data RatatuiRuby::Text::Line...>`) instead of the styled text.
|
|
50
|
+
|
|
51
|
+
### Removed
|
|
52
|
+
|
|
21
53
|
## [0.7.0] - 2026-01-03
|
|
22
54
|
|
|
23
55
|
> [!WARNING]
|
|
@@ -356,6 +388,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
356
388
|
- **Testing Support**: Included `RatatuiRuby::TestHelper` and RSpec integration to make testing your TUI applications possible.
|
|
357
389
|
|
|
358
390
|
[Unreleased]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/HEAD
|
|
391
|
+
[0.7.2]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.2
|
|
392
|
+
[0.7.1]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.1
|
|
359
393
|
[0.7.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.0
|
|
360
394
|
[0.6.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.6.0
|
|
361
395
|
[0.5.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.5.0
|
data/README.md
CHANGED
|
@@ -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).
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: 2025 Kerrick Long <me@kerricklong.com>
|
|
3
|
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Async Operations in TUI Applications
|
|
7
|
+
|
|
8
|
+
TUI applications fetch data from APIs, run shell commands, and query databases. These operations take time. Blocking the render loop freezes the interface.
|
|
9
|
+
|
|
10
|
+
You want responsive UIs. The checklist shows "Loading..." while data arrives. The interface never hangs.
|
|
11
|
+
|
|
12
|
+
This guide explains async patterns that work with raw terminal mode.
|
|
13
|
+
|
|
14
|
+
## The Raw Terminal Problem
|
|
15
|
+
|
|
16
|
+
`RatatuiRuby.run` enters raw terminal mode:
|
|
17
|
+
|
|
18
|
+
- stdin reconfigures for character-by-character input
|
|
19
|
+
- stdout carries terminal escape sequences
|
|
20
|
+
- External commands expecting normal terminal I/O fail
|
|
21
|
+
|
|
22
|
+
### What Breaks
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
# These fail inside a Thread during raw mode:
|
|
26
|
+
`git ls-remote --tags origin` # Returns empty or hangs
|
|
27
|
+
IO.popen(["git", "ls-remote", ...]) # Same
|
|
28
|
+
Open3.capture2("git", "ls-remote", ...) # Same
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The commands succeed synchronously. They fail asynchronously. The difference: thread context inherits the parent's raw terminal state.
|
|
32
|
+
|
|
33
|
+
### Why Threads Fail
|
|
34
|
+
|
|
35
|
+
Ruby's GIL releases during I/O. But:
|
|
36
|
+
|
|
37
|
+
1. Subprocesses inherit the parent's terminal state.
|
|
38
|
+
2. Git/SSH try to read credentials from raw-mode stdin.
|
|
39
|
+
3. The read blocks forever. Or returns empty.
|
|
40
|
+
|
|
41
|
+
`GIT_TERMINAL_PROMPT=0` prevents prompts. Auth fails silently instead of hanging.
|
|
42
|
+
|
|
43
|
+
## Solutions
|
|
44
|
+
|
|
45
|
+
### Pre-Check Before Raw Mode
|
|
46
|
+
|
|
47
|
+
Run slow operations before entering the TUI:
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
def initialize
|
|
51
|
+
@data = fetch_data # Runs before RatatuiRuby.run
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Trade-off**: Delays startup.
|
|
56
|
+
|
|
57
|
+
### Process.spawn with File Output
|
|
58
|
+
|
|
59
|
+
Spawn a separate process before entering raw mode. Write results to a temp file. Poll for completion:
|
|
60
|
+
|
|
61
|
+
```ruby
|
|
62
|
+
class AsyncChecker
|
|
63
|
+
CACHE_FILE = File.join(Dir.tmpdir, "my_check_result.txt")
|
|
64
|
+
|
|
65
|
+
def initialize
|
|
66
|
+
@loading = true
|
|
67
|
+
@result = nil
|
|
68
|
+
@pid = Process.spawn("my-command > #{CACHE_FILE}")
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def loading?
|
|
72
|
+
return false unless @loading
|
|
73
|
+
|
|
74
|
+
# Non-blocking poll
|
|
75
|
+
_pid, status = Process.waitpid2(@pid, Process::WNOHANG)
|
|
76
|
+
if status
|
|
77
|
+
@result = File.read(CACHE_FILE).strip
|
|
78
|
+
@loading = false
|
|
79
|
+
end
|
|
80
|
+
@loading
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Key points**:
|
|
86
|
+
|
|
87
|
+
- `Process.spawn` returns immediately.
|
|
88
|
+
- The command runs in a separate process, not a thread.
|
|
89
|
+
- Results pass through a temp file. Avoids pipe/terminal issues.
|
|
90
|
+
- `Process::WNOHANG` polls without blocking.
|
|
91
|
+
|
|
92
|
+
### Thread for CPU-Bound Work
|
|
93
|
+
|
|
94
|
+
Ruby threads work for pure computation:
|
|
95
|
+
|
|
96
|
+
```ruby
|
|
97
|
+
Thread.new { @result = expensive_calculation }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Avoid threads for shell commands.
|
|
101
|
+
|
|
102
|
+
## Ractors
|
|
103
|
+
|
|
104
|
+
Ractors provide true parallelism. Trade-offs:
|
|
105
|
+
|
|
106
|
+
- No mutable shared state.
|
|
107
|
+
- Limited to Ractor-safe values.
|
|
108
|
+
- Terminal I/O issues remain.
|
|
109
|
+
|
|
110
|
+
For TUI async, `Process.spawn` solves the problem cleanly.
|
|
111
|
+
|
|
112
|
+
## Pattern Summary
|
|
113
|
+
|
|
114
|
+
| Approach | Use Case | Raw Mode Safe? |
|
|
115
|
+
|----------|----------|----------------|
|
|
116
|
+
| Sync before TUI | Fast checks (<100ms) | Yes |
|
|
117
|
+
| Process.spawn + file | Shell commands, network | Yes |
|
|
118
|
+
| Thread | CPU-bound Ruby code | Yes |
|
|
119
|
+
| Thread + shell | Shell commands | **No** |
|
|
120
|
+
|
|
121
|
+
## Real Example: Git Tag Check
|
|
122
|
+
|
|
123
|
+
Check if a tag exists on the remote:
|
|
124
|
+
|
|
125
|
+
```ruby
|
|
126
|
+
class GitRepo
|
|
127
|
+
CACHE_FILE = File.join(Dir.tmpdir, "git_tag_pushed.txt")
|
|
128
|
+
|
|
129
|
+
def initialize
|
|
130
|
+
@version = `git describe --tags --abbrev=0`.strip
|
|
131
|
+
@tag_pushed = nil
|
|
132
|
+
@loading = true
|
|
133
|
+
@pid = Process.spawn(
|
|
134
|
+
"git ls-remote --tags origin | grep -q '#{@version}' " \
|
|
135
|
+
"&& echo true > #{CACHE_FILE} || echo false > #{CACHE_FILE}"
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def loading?
|
|
140
|
+
return false unless @loading
|
|
141
|
+
|
|
142
|
+
_pid, status = Process.waitpid2(@pid, Process::WNOHANG)
|
|
143
|
+
if status
|
|
144
|
+
@tag_pushed = File.read(CACHE_FILE).strip == "true"
|
|
145
|
+
@loading = false
|
|
146
|
+
end
|
|
147
|
+
@loading
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def refresh
|
|
151
|
+
# Sync version for manual refresh (user presses 'r')
|
|
152
|
+
@loading = true
|
|
153
|
+
remote_tags = `git ls-remote --tags origin`.strip
|
|
154
|
+
@tag_pushed = remote_tags.include?(@version)
|
|
155
|
+
@loading = false
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The TUI starts instantly. The tag check runs in the background. The checklist updates when the result arrives.
|
|
@@ -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).
|
|
@@ -254,7 +254,7 @@ def test_initial_render
|
|
|
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
|
|
|
@@ -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
|
|